Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
keyboard-shortcuts: Display "Ctrl" for Vim "Esc" keybinding behavior.
Lauryn Menardbc0f9c487695
diff --git a/help/configure-home-view.md b/help/configure-home-view.mdindex a0b9cc35b8e..6f958508de7 100644--- a/help/configure-home-view.md+++ b/help/configure-home-view.md@@ -13,8 +13,8 @@ on how to use these views.You can configure which view is set as your home view, and whetherthe <kbd>Esc</kbd> key navigates to the home view. Also, you can-always reach the home view by using the <kbd>Ctrl</kbd> + <kbd>[</kbd>-shortcut.+always reach the home view by using the+<kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd> shortcut.## Change home view@@ -44,7 +44,8 @@ organization settings:1. To see your changes in action, open a new Zulip tab, or use a keyboardshortcut twice to exit the settings and navigate to your home view- (<kbd>Ctrl</kbd> + <kbd>[</kbd> or <kbd>Esc</kbd> if enabled).+ (<kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd> or <kbd>Esc</kbd>+ if enabled).!!! tip ""@@ -62,8 +63,8 @@ designed to enhance the user experience in the app.By default, the <kbd>Esc</kbd> key shortcut will ultimately navigate toyour home view. You can disable this key binding if you would prefer.This will not disable other <kbd>Esc</kbd> key shortcuts used in Zulip,-and will not affect the behavior of the <kbd>Ctrl</kbd> + <kbd>[</kbd>-shortcut.+and will not affect the behavior of the+<kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd> shortcut.### Toggle whether <kbd>Esc</kbd> navigates to the home viewdiff --git a/help/keyboard-shortcuts.md b/help/keyboard-shortcuts.mdindex 0fc927325b1..c6c025e7db3 100644--- a/help/keyboard-shortcuts.md+++ b/help/keyboard-shortcuts.md@@ -32,9 +32,9 @@ in the Zulip app to add more to your repertoire as needed.<kbd>Ctrl</kbd> + <kbd>V</kbd>, and press <kbd>Ctrl</kbd> + <kbd>Z</kbd> toremove formatting.-* **Cancel compose and save draft**: <kbd>Esc</kbd> or <kbd>Ctrl</kbd> +- <kbd>[</kbd> — Close the compose box and save the unsent message as a- draft.+* **Cancel compose and save draft**: <kbd>Esc</kbd> or+ <kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd> — Close the compose box+ and save the unsent message as a draft.* **View drafts**: <kbd>D</kbd> — Use the arrow keys and <kbd>Enter</kbd>to restore a draft. Press <kbd>D</kbd> again to close.@@ -54,8 +54,8 @@ in the Zulip app to add more to your repertoire as needed.* **Toggle keyboard shortcuts view**: <kbd>?</kbd>-* **Go to your home view**: <kbd>Ctrl</kbd> + <kbd>[</kbd> (or- <kbd>Esc</kbd>, [if enabled][disable-escape])+* **Go to your home view**: <kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd>+ (or <kbd>Esc</kbd>, [if enabled][disable-escape])until you are in your [home view](/help/configure-home-view).[disable-escape]: /help/configure-home-view#configure-whether-esc-navigates-to-the-home-view@@ -158,8 +158,9 @@ in the Zulip app to add more to your repertoire as needed.* **Toggle preview mode**: <kbd>Alt</kbd> + <kbd>P</kbd>-* **Cancel compose and save draft**: <kbd>Esc</kbd> or <kbd>Ctrl</kbd> +- <kbd>[</kbd> — Close the compose box and save the unsent message as a draft.+* **Cancel compose and save draft**: <kbd>Esc</kbd> or+ <kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd> — Close the compose box+ and save the unsent message as a draft.## Message actionsdiff --git a/web/src/common.ts b/web/src/common.tsindex 9e80d2b70a4..d9b5018a76b 100644--- a/web/src/common.ts+++ b/web/src/common.ts@@ -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;diff --git a/web/templates/keyboard_shortcuts.hbs b/web/templates/keyboard_shortcuts.hbsindex 9a3b75cc9b3..ddd9a7a8727 100644--- a/web/templates/keyboard_shortcuts.hbs+++ b/web/templates/keyboard_shortcuts.hbs@@ -30,7 +30,7 @@</tr><tr><td class="definition">{{t 'Cancel compose and save draft' }}</td>- <td><span class="hotkey"><kbd>Esc</kbd> or <kbd>Ctrl</kbd> + <kbd>[</kbd></span></td>+ <td><span class="hotkey"><kbd>Esc</kbd> or <kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd></span></td></tr><tr><td class="definition">{{t 'View drafts' }}</td>@@ -66,7 +66,7 @@</tr><tr><td class="definition">{{t 'Go to your home view' }}</td>- <td><span class="hotkey"><kbd>Ctrl</kbd> + <kbd>[</kbd><span id="go-to-home-view-hotkey-help"> or <kbd>Esc</kbd></span></span></td>+ <td><span class="hotkey"><kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd><span id="go-to-home-view-hotkey-help"> or <kbd>Esc</kbd></span></span></td></tr></table></div>@@ -238,7 +238,7 @@</tr><tr><td class="definition">{{t 'Cancel compose and save draft' }}</td>- <td><span class="hotkey"><kbd>Esc</kbd> or <kbd>Ctrl</kbd> + <kbd>[</kbd></span></td>+ <td><span class="hotkey"><kbd>Esc</kbd> or <kbd data-mac-key="Ctrl">Ctrl</kbd> + <kbd>[</kbd></span></td></tr></table></div>