diff --git a/help/keyboard-shortcuts.md b/help/keyboard-shortcuts.md index 4e55fd30bf..a8c5c2cd27 100644 --- a/help/keyboard-shortcuts.md +++ b/help/keyboard-shortcuts.md @@ -73,10 +73,10 @@ in the Zulip app to add more to your repertoire as needed. * **Scroll down**: PgDn, Shift + J, or Spacebar -* **Go back through viewing history**: Alt + +* **Go back through viewing history**: Alt + ← -* **Go forward through viewing history**: Alt + +* **Go forward through viewing history**: Alt + → ## Narrowing diff --git a/web/src/common.ts b/web/src/common.ts index 0cd303a707..d154467447 100644 --- a/web/src/common.ts +++ b/web/src/common.ts @@ -45,7 +45,7 @@ const keys_map = new Map([ ["PgUp", "↑"], ["PgDn", "↓"], ["Ctrl", "⌘"], - ["Alt", "⌘"], + ["Alt", "⌥"], ]); const fn_shortcuts = new Set(["Home", "End", "PgUp", "PgDn"]); @@ -69,7 +69,12 @@ export function adjust_mac_kbd_tags(kbd_elem_class: string): void { $(this).addClass("arrow-key"); } - const replace_key = keys_map.get(key_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`. + const replace_key = $(this).attr("data-mac-key") ?? keys_map.get(key_text); if (replace_key !== undefined) { key_text = replace_key; } diff --git a/web/templates/keyboard_shortcuts.hbs b/web/templates/keyboard_shortcuts.hbs index e7f1aa81fd..18496ef362 100644 --- a/web/templates/keyboard_shortcuts.hbs +++ b/web/templates/keyboard_shortcuts.hbs @@ -107,11 +107,11 @@