Revert making keybinding display in Mac menus use standard precedence (#23661)

Closes #23621

Change was in #23378. Also adds a comment to clarify why this is
inconsistent with all other uses of `bindings_for_action`.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-01-25 21:35:01 -07:00 committed by GitHub
parent 6fca1d2b0b
commit 84b945e89d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -290,9 +290,13 @@ impl MacPlatform {
action, action,
os_action, os_action,
} => { } => {
// Note that this is not the standard logic for selecting which keybinding to
// display. Typically the last binding takes precedence for display. However, in
// this case the menus are not updated on context changes. To make these bindings
// more likely to be correct, the first binding instead takes precedence (typically
// from the base keymap).
let keystrokes = keymap let keystrokes = keymap
.bindings_for_action(action.as_ref()) .bindings_for_action(action.as_ref())
.rev()
.next() .next()
.map(|binding| binding.keystrokes()); .map(|binding| binding.keystrokes());