mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
docs: Update keyboard shortcuts to always show "Fn" key option.
Previously, these were only shown for Mac OS users and replaced the "Home", "End", "PgUp" and "PgDn" shortcuts. But as this really depends on the keyboard the user is using (there are Mac keyboards with the above keys), we instead show both options in our web app and help center documentation on keyboard shortcuts. The tooltip for the "Scroll to bottom" button will now always show "End" for all users. Previously, it showed a "Fn" key option for Mac users. Fixes #31815.
This commit is contained in:
committed by
Tim Abbott
parent
93c172ee3f
commit
3e3ca26aae
@@ -14,16 +14,10 @@ export function phrase_match(query: string, phrase: string): boolean {
|
||||
const keys_map = new Map([
|
||||
["Backspace", "Delete"],
|
||||
["Enter", "Return"],
|
||||
["Home", "←"],
|
||||
["End", "→"],
|
||||
["PgUp", "↑"],
|
||||
["PgDn", "↓"],
|
||||
["Ctrl", "⌘"],
|
||||
["Alt", "⌥"],
|
||||
]);
|
||||
|
||||
const fn_shortcuts = new Set(["Home", "End", "PgUp", "PgDn"]);
|
||||
|
||||
export function has_mac_keyboard(): boolean {
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
return /mac/i.test(navigator.platform);
|
||||
@@ -39,11 +33,6 @@ export function adjust_mac_kbd_tags(kbd_elem_class: string): void {
|
||||
$(kbd_elem_class).each(function () {
|
||||
let key_text = $(this).text();
|
||||
|
||||
if (fn_shortcuts.has(key_text)) {
|
||||
$(this).before($("<kbd>").text("Fn"), $("<span>").text(" + ").contents());
|
||||
$(this).addClass("arrow-key");
|
||||
}
|
||||
|
||||
// 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
|
||||
@@ -81,10 +70,6 @@ export function adjust_mac_hotkey_hints(hotkeys: string[]): void {
|
||||
if (replace_key !== undefined) {
|
||||
hotkeys[index] = replace_key;
|
||||
}
|
||||
|
||||
if (fn_shortcuts.has(hotkey)) {
|
||||
hotkeys.unshift("Fn");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user