mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-18 04:44:18 +08:00
🐛 fix(datagrid): 修复筛选字段选择失效
- 将 Select 下拉选项识别为交互目标 - 避免页内查找焦点逻辑中断字段选择 - 补充下拉选项交互目标回归测试
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user