iter(g28): 浮层 Esc 逐层关闭,阻止冒泡连带关外层

This commit is contained in:
HIsheR
2026-10-26 11:38:44 +08:00
parent b263075e65
commit d9feeda0fd
10 changed files with 33 additions and 12 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ export function tooltip(props: TooltipProps, trigger: HTMLElement): HTMLElement
root.addEventListener('focusout', hide); // 失焦
effect(() => { if (open()) place(flip(trigger, bubble, props.placement ?? 'top')); }); // 每次出场重算方位:空间不足自动翻转
root.addEventListener('keydown', (e: KeyboardEvent) => {
if (e.key === 'Escape') hide(); // Esc 立即收起,不必等延迟
if (e.key === 'Escape') { e.stopPropagation(); hide(); } // Esc 立即收起且不影响外层弹层
});
return root;
}