mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-28 06:22:33 +00:00
fix: tooltips show on keyboard focus and Escape hides them (#32644)
This commit is contained in:
parent
c4153a6eea
commit
f36490bf2f
1 changed files with 19 additions and 0 deletions
|
|
@ -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
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue