mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
keyboard-shortcuts: Display "Ctrl" for Vim "Esc" keybinding behavior.
For all users, we want to display "Ctrl" for the "Ctrl" "[" keyboard shortcuts that match the "Esc" Vim keybinding behavior. We use the "data-mac-key" attribute to override the default mapping of "Ctrl" to "Cmd" for Mac users in the documentation of these keyboard shortcuts. Fixes #20107.
This commit is contained in:
committed by
Tim Abbott
parent
40524e6dfa
commit
bc0f9c4876
@@ -34,10 +34,14 @@ export function adjust_mac_kbd_tags(kbd_elem_class: string): void {
|
||||
let key_text = $(this).text();
|
||||
|
||||
// We use data-mac-key attribute to override the default key in case
|
||||
// of exceptions. Currently, there are 2 shortcuts (for navigating back
|
||||
// and forth in browser history) which need `Cmd` instead of the expected
|
||||
// mapping (`Opt`) for the `Alt` key, so we use this attribute to override
|
||||
// `Opt` with `Cmd`.
|
||||
// of exceptions:
|
||||
// - There are 2 shortcuts (for navigating back and forth in browser
|
||||
// history) which need "⌘" instead of the expected mapping ("Opt")
|
||||
// for the "Alt" key, so we use this attribute to override "Opt"
|
||||
// with "⌘".
|
||||
// - The "Ctrl" + "[" shortcuts (which match the Vim keybinding behavior
|
||||
// of mapping to "Esc") need to display "Ctrl" for all users, so we
|
||||
// use this attribute to override "⌘" with "Ctrl".
|
||||
const replace_key = $(this).attr("data-mac-key") ?? keys_map.get(key_text);
|
||||
if (replace_key !== undefined) {
|
||||
key_text = replace_key;
|
||||
|
||||
Reference in New Issue
Block a user