fix: tooltips show on keyboard focus and Escape hides them (#32644)

This commit is contained in:
G30 2026-10-20 18:51:21 -04:00 • committed by GitHub
parent c4153a6eea
commit f36490bf2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,10 +58,29 @@
placement,
allowHTML,
touch,
trigger: 'mouseenter focusin',
...(theme !== '' ? { theme } : { theme: 'dark' }),
arrow: false,
offset,
...(interactive ? { interactive: true } : {}),
plugins: [
{
fn: (instance) => {
const onKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
e.stopPropagation();
instance.hide();
}
};
return {
onShow: () => document.addEventListener('keydown', onKeyDown),
onHide: () => document.removeEventListener('keydown', onKeyDown),
onDestroy: () => document.removeEventListener('keydown', onKeyDown)
};
}
}
],
...tippyOptions
});
}