iter(g28): 浮层 Esc 逐层关闭,阻止冒泡连带关外层
This commit is contained in:
@@ -53,6 +53,7 @@ export function popover(props: PopoverProps, trigger: HTMLElement): HTMLElement
|
||||
}
|
||||
root.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||
if (e.key !== 'Escape' || !open()) return; // 卫语句:未展开时 Esc 不处理
|
||||
e.stopPropagation(); // 只关本层,避免连带关闭外层弹窗
|
||||
setOpen(false);
|
||||
trigger.focus(); // 收起后焦点回触发器
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user