Low: global ? shortcut can open a second dialog over an active confirmation modal
Impact
Low / keyboard accessibility — the global question-mark shortcut can open the keyboard shortcuts dialog on top of an existing confirmation modal, producing two simultaneous dialogs and competing focus/escape handling. This can interrupt a destructive-action review or an unsaved-changes decision.
Code evidence
useHotkey.ts:35–49checks repeats, composition, modifiers and whether the focused target is an editable field, but does not check if a modal/dialog is already active. A focused confirmation button is not editable.ShortcutsHelpDialog.tsx:14–37registersuseHotkey("?", false, () => setOpen(true))for the entire app and renders its ownDialog.Root.App.tsx:1036–1059mounts the shortcut dialog outside the routed view while Settings, Delete chat, or memory confirmation dialogs can be open.ShortcutsHelpDialog.test.tsxtests opening/closing alone, not the two-overlay scenario.
Reproduction
- Open the Delete chat confirmation or Settings Save your changes? dialog; leave keyboard focus on one of its buttons.
- Press the key that produces
?. - Actual: the global listener opens Keyboard shortcuts without considering the existing modal; both dialogs remain open in React, causing nested modal/focus-trap interaction.
- Expected: an active modal retains keyboard focus and exclusive control of shortcuts; the global Help shortcut should not open a second dialog until the first closes.
Fix/tests
Have the shortcut handler refuse opening while any other modal/alertdialog is active (or centralize overlay arbitration and close/suspend the previous overlay). Preserve shortcut operation from ordinary page buttons and noneditable controls. Add a DOM test that opens a confirmation, focuses a button, dispatches ?, and checks no shortcuts dialog appears; verify it opens normally after closing the first dialog.
Reviewed revision: e824fe2dcba0d1be127c9fff165f776186dc37e9. Deterministic keyboard handler path; full browser focus-trap test not run.