diff --git a/help/keyboard-shortcuts.md b/help/keyboard-shortcuts.md index 44312a9419..fd72a98282 100644 --- a/help/keyboard-shortcuts.md +++ b/help/keyboard-shortcuts.md @@ -69,19 +69,21 @@ in the Zulip app to add more to your repertoire as needed. ## Scrolling -* **Last message**: End or Shift + G — - Also marks all messages in the current view as read. +* **Last message**: End or Fn + + or Shift + G — Also marks all messages in the current view + as read. -* **First message**: Home +* **First message**: Home or Fn + * **Previous message**: or K * **Next message**: or J -* **Scroll up**: PgUp or Shift + K +* **Scroll up**: PgUp or Fn + + or Shift + K -* **Scroll down**: PgDn, Shift + J, or - Spacebar +* **Scroll down**: PgDn or Fn + + or Shift + J or Spacebar ## Navigation diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index 6ea5c5ab18..f3efcfa046 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -161,12 +161,6 @@ js_rules = RuleList( "web/tests/", "web/src/billing/", }, - "exclude_line": { - ( - "web/src/common.ts", - '$(this).before($("").text("Fn"), $("").text(" + ").contents());', - ), - }, }, { "pattern": r"""report.success\(["']""", diff --git a/web/src/common.ts b/web/src/common.ts index c429efdaa6..9e80d2b70a 100644 --- a/web/src/common.ts +++ b/web/src/common.ts @@ -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($("").text("Fn"), $("").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"); - } } } diff --git a/web/templates/keyboard_shortcuts.hbs b/web/templates/keyboard_shortcuts.hbs index 515acca0f0..fa26a96fc0 100644 --- a/web/templates/keyboard_shortcuts.hbs +++ b/web/templates/keyboard_shortcuts.hbs @@ -108,19 +108,19 @@ {{t 'Scroll up' }} - PgUp or Shift + K + PgUp or Fn + or Shift + K {{t 'Scroll down' }} - PgDn or Shift + J or Space + PgDn or Fn + or Shift + J or Space {{t 'Last message' }} - End or Shift + G + End or Fn + or Shift + G {{t 'First message' }} - Home + Homeor Fn + diff --git a/web/tests/common.test.js b/web/tests/common.test.js index c4318ea489..bcfe7c0219 100644 --- a/web/tests/common.test.js +++ b/web/tests/common.test.js @@ -42,10 +42,6 @@ run_test("adjust_mac_kbd_tags mac", ({override}) => { const keys_to_test_mac = new Map([ ["Backspace", "Delete"], ["Enter", "Return"], - ["Home", "←"], - ["End", "→"], - ["PgUp", "↑"], - ["PgDn", "↓"], ["Ctrl", "⌘"], ["Alt", "⌥"], ["#stream_name", "#stream_name"], @@ -55,8 +51,6 @@ run_test("adjust_mac_kbd_tags mac", ({override}) => { ["data-mac-following-key", "data-mac-following-key"], ]); - const fn_shortcuts = new Set(["Home", "End", "PgUp", "PgDn"]); - override(navigator, "platform", "MacIntel"); $("").contents = () => $(""); @@ -67,12 +61,6 @@ run_test("adjust_mac_kbd_tags mac", ({override}) => { const test_item = {}; const $stub = $.create("hotkey_" + key_no); $stub.text(old_key); - assert.equal($stub.hasClass("arrow-key"), false); - if (fn_shortcuts.has(old_key)) { - $stub.before = ($elem) => { - assert.equal($elem.selector, ""); - }; - } if (old_key === "data-mac-following-key") { $stub.attr("data-mac-following-key", "⌥"); $stub.after = ($plus, $elem) => { @@ -83,7 +71,6 @@ run_test("adjust_mac_kbd_tags mac", ({override}) => { } test_item.$stub = $stub; test_item.mac_key = mac_key; - test_item.adds_arrow_key = fn_shortcuts.has(old_key); test_items.push(test_item); key_no += 1; } @@ -96,7 +83,6 @@ run_test("adjust_mac_kbd_tags mac", ({override}) => { for (const test_item of test_items) { assert.equal(test_item.$stub.text(), test_item.mac_key); - assert.equal(test_item.$stub.hasClass("arrow-key"), test_item.adds_arrow_key); } }); @@ -115,10 +101,6 @@ run_test("adjust_mac_hotkey_hints mac expected", ({override}) => { const keys_to_test_mac = new Map([ [["Backspace"], ["Delete"]], [["Enter"], ["Return"]], - [["Home"], ["Fn", "←"]], - [["End"], ["Fn", "→"]], - [["PgUp"], ["Fn", "↑"]], - [["PgDn"], ["Fn", "↓"]], [["Ctrl"], ["⌘"]], ]);