Fix W8/W9: add Ctrl+, Settings shortcut; restore focus on palette close

W8: Added Ctrl+, as a standard Settings accelerator alongside the existing
    Ctrl+K palette shortcut. The key handler now handles both in one listener
    so there's a single window.addEventListener lifecycle.

W9: Command palette now restores focus to the previously focused element when
    it closes. prePaletteRef stores document.activeElement at open time;
    onClose fires a requestAnimationFrame focus-restore after unmounting the
    palette, so the focus returns to the trigger (a sidebar nav button, the
    URL input, etc.) rather than leaving focus stranded at the document body.

typecheck + 242 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 14:39:51 -04:00
parent 53aaed5fef
commit 04109d8220
2 changed files with 18 additions and 5 deletions
+2 -2
View File
@@ -999,10 +999,10 @@ DPI handled by Chromium). The deviations:
- [x] **W7 — Lists have no keyboard navigation.** The queue, history, and library lists can't be arrowed
through, **Delete** doesn't remove the focused/selected item, and there's no **Ctrl+A** select-all —
all standard Windows list behaviors. **Standard:** roving focus + Delete/Ctrl+A on list surfaces. *(a11y; see also UI30)*
- [ ] **W8 — No standard accelerators.** No **Ctrl+,** (Settings), **F1** (help), or **F5** (refresh);
- [x] **W8 — No standard accelerators.** No **Ctrl+,** (Settings), **F1** (help), or **F5** (refresh);
Ctrl+K (palette) is the only global shortcut and is undiscoverable (UX21). **Standard:** add the
conventional accelerators + a discoverable shortcut list.
- [ ] **W9 — Focus isn't restored or advanced.** Closing the command palette doesn't return focus to the
- [x] **W9 — Focus isn't restored or advanced.** Closing the command palette doesn't return focus to the
trigger; finishing onboarding and switching tabs don't move focus into the new content. **Standard:**
restore focus on overlay close; move focus to the activated panel. *(extends UI28UI29)*
- [ ] **(ref) Context menus absent app-wide** — UI24; the text-field case is W4.