diff --git a/frontend/src/utils/shortcuts.test.ts b/frontend/src/utils/shortcuts.test.ts index bbf24700..046ac7cb 100644 --- a/frontend/src/utils/shortcuts.test.ts +++ b/frontend/src/utils/shortcuts.test.ts @@ -18,6 +18,7 @@ import { getShortcutDisplayLabel, getShortcutPrimaryModifierDisplayLabel, installGlobalImeCompositionTracking, + isEditableElement, isGlobalImeCompositionActive, isGlobalShortcutCaptureActive, isImeComposingKeyEvent, @@ -39,6 +40,33 @@ beforeEach(() => { setGlobalShortcutCaptureActive(false); }); +describe('editable targets', () => { + it('treats Ant Design select dropdown options as interactive targets', () => { + const OriginalHTMLElement = globalThis.HTMLElement; + class MockHTMLElement { + tagName = 'div'; + isContentEditable = false; + + closest(selector: string) { + return selector.includes('.ant-select-dropdown') ? this : null; + } + } + Object.defineProperty(globalThis, 'HTMLElement', { + configurable: true, + value: MockHTMLElement, + }); + + try { + expect(isEditableElement(new MockHTMLElement() as unknown as EventTarget)).toBe(true); + } finally { + Object.defineProperty(globalThis, 'HTMLElement', { + configurable: true, + value: OriginalHTMLElement, + }); + } + }); +}); + // ─── findReservedConflict ──────────────────────────────────────────── describe('findReservedConflict', () => { diff --git a/frontend/src/utils/shortcuts.ts b/frontend/src/utils/shortcuts.ts index f7a0dc14..f2ec59d5 100644 --- a/frontend/src/utils/shortcuts.ts +++ b/frontend/src/utils/shortcuts.ts @@ -851,7 +851,7 @@ export const isEditableElement = (target: EventTarget | null): boolean => { if (tag === 'input' || tag === 'textarea' || tag === 'select') { return true; } - if (target.closest('.monaco-editor, .monaco-inputbox, .ant-select, .ant-picker, .ant-input')) { + if (target.closest('.monaco-editor, .monaco-inputbox, .ant-select, .ant-select-dropdown, .ant-picker, .ant-input')) { return true; } return false;