diff --git a/lib/__tests__/shortcut-alternatives.test.ts b/lib/__tests__/shortcut-alternatives.test.ts new file mode 100644 index 000000000..73d202122 --- /dev/null +++ b/lib/__tests__/shortcut-alternatives.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from 'vitest'; +import { SHORTCUT_APPS } from '@/lib/keyboard-shortcuts'; +import { shortcutAlternatives } from '@/lib/shortcut-keys'; + +// The shortcuts help shows " / " as "or" between whole keys. "Shift + ↓ / ↑" +// read as "Shift + ↓ or ↑", which says plain ↑ also extends the selection. + +describe('shortcut alternatives', () => { + it('spell out the modifier in every alternative', () => { + const bad: string[] = []; + for (const app of SHORTCUT_APPS) { + for (const section of app.sections) { + for (const entry of section.entries) { + const alternatives = shortcutAlternatives(entry.key); + const modified = alternatives.some((key) => key.includes(' + ')); + if (modified && alternatives.some((key) => !key.includes(' + '))) bad.push(`${app.id}: ${entry.key}`); + } + } + } + expect(bad).toEqual([]); + }); +}); diff --git a/lib/keyboard-shortcuts/mail.ts b/lib/keyboard-shortcuts/mail.ts index 1ee3eec54..639e5b179 100644 --- a/lib/keyboard-shortcuts/mail.ts +++ b/lib/keyboard-shortcuts/mail.ts @@ -27,7 +27,7 @@ export const MAIL_SHORTCUTS = { { key: "/", description: "shortcuts.global.search" }, { key: "Shift + G", description: "shortcuts.global.refresh" }, { key: "Mod + A", description: "shortcuts.global.select_all" }, - { key: "Shift + ↓ / ↑", description: "shortcuts.global.extend_selection" }, + { key: "Shift + ↓ / Shift + ↑", description: "shortcuts.global.extend_selection" }, ], threads: [ { key: "x", description: "shortcuts.threads.expand_collapse", layout: "default" },