fix(app): keep focused tooltip controls open

This commit is contained in:
Michael Wu
2026-10-04 05:54:18 +09:00
parent 8ee1f640d3
commit 0d0fd2f2e8
2 changed files with 29 additions and 8 deletions
+14 -2
View File
@@ -284,11 +284,23 @@ export function Tooltip({
return;
}
closeTimerRef.current = setTimeout(() => {
setIsOpen(false);
closeTimerRef.current = null;
if (
isWeb &&
typeof document !== "undefined" &&
contentRef.current &&
(contentRef.current as unknown as HTMLElement).contains(document.activeElement)
) {
return;
}
setIsOpen(false);
}, 100);
}, [cancelClose, interactive, setIsOpen]);
const focusContent = useCallback(() => focusFirstContentControl(contentRef.current), []);
const focusContent = useCallback(() => {
const focused = focusFirstContentControl(contentRef.current);
if (focused) cancelClose();
return focused;
}, [cancelClose]);
useEffect(() => cancelClose, [cancelClose]);