{question}
diff --git a/apps/desktop/src/lib/keybinds/composer-focus-keys.test.ts b/apps/desktop/src/lib/keybinds/composer-focus-keys.test.ts
index cab689da0aa6..cebf54950e42 100644
--- a/apps/desktop/src/lib/keybinds/composer-focus-keys.test.ts
+++ b/apps/desktop/src/lib/keybinds/composer-focus-keys.test.ts
@@ -72,6 +72,22 @@ describe('composerFocusBlockedBySurface', () => {
expect(composerFocusBlockedBySurface()).toBe(true)
})
+ it('blocks while an overlay covers the chat (composer sits behind it)', () => {
+ const overlay = document.createElement('div')
+ overlay.setAttribute('data-overlay-surface', '')
+ document.body.append(overlay)
+
+ expect(composerFocusBlockedBySurface()).toBe(true)
+ })
+
+ it('blocks while a live clarify choices card owns its letter keys', () => {
+ const card = document.createElement('div')
+ card.setAttribute('data-clarify-choices', '')
+ document.body.append(card)
+
+ expect(composerFocusBlockedBySurface()).toBe(true)
+ })
+
it('blocks when focus is inside a terminal', () => {
const term = document.createElement('div')
term.setAttribute('data-terminal', '')
@@ -146,4 +162,16 @@ describe('composerFocusKeysAllowed', () => {
expect(composerFocusKeysAllowed(keydown({ key: 'a', code: 'KeyA', target: document.body }), 'type')).toBe(false)
})
+
+ it('yields letter + Enter keys to a live clarify choices card', () => {
+ const card = document.createElement('div')
+ card.setAttribute('data-clarify-choices', '')
+ document.body.append(card)
+
+ // The clarify card's own A/B/C… + Enter shortcuts must win over type-to-focus.
+ expect(composerFocusKeysAllowed(keydown({ key: 'a', code: 'KeyA', target: document.body }), 'type')).toBe(false)
+ expect(composerFocusKeysAllowed(keydown({ key: 'Enter', code: 'Enter', target: document.body }), 'enter')).toBe(
+ false
+ )
+ })
})
diff --git a/apps/desktop/src/lib/keybinds/composer-focus-keys.ts b/apps/desktop/src/lib/keybinds/composer-focus-keys.ts
index 2e2a9f82fc60..6bba44aa34a1 100644
--- a/apps/desktop/src/lib/keybinds/composer-focus-keys.ts
+++ b/apps/desktop/src/lib/keybinds/composer-focus-keys.ts
@@ -38,7 +38,7 @@ const ENTER_ACTIVATES = [
].join(',')
const BLOCKING_SURFACE =
- '[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"],[data-radix-popper-content-wrapper]'
+ '[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"],[data-radix-popper-content-wrapper],[data-overlay-surface],[data-clarify-choices]'
/** True when the focused control would normally handle Enter itself. */
export function isActivateOnEnterTarget(target: EventTarget | null): boolean {
@@ -47,7 +47,13 @@ export function isActivateOnEnterTarget(target: EventTarget | null): boolean {
return Boolean(el && el !== document.body && el !== document.documentElement && el.closest(ENTER_ACTIVATES))
}
-/** Dialogs, menus, terminal, full pages, session switcher — they keep their keys. */
+/**
+ * Dialogs, menus, terminal, full pages, session switcher, any open overlay
+ * (settings / command-center / star map / …), and a live clarify choices card —
+ * they keep their keys, so type-to-focus / soft `/` / Enter stand down rather
+ * than stealing keystrokes those surfaces own (or leaking them into the composer
+ * mounted behind an overlay).
+ */
export function composerFocusBlockedBySurface(): boolean {
return (
switcherActive() ||