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:
Lauryn Menard
2024-10-02 15:13:23 +02:00
committed by Tim Abbott
parent 93c172ee3f
commit 3e3ca26aae
5 changed files with 12 additions and 49 deletions

View File

@@ -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");
}
}
}