mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-29 06:32:52 +00:00
fix(a11y): a tooltip no longer stays open when focus returns to its button after a mouse click (#33170)
This commit is contained in:
parent
0286709f9c
commit
af6c382d3a
1 changed files with 11 additions and 1 deletions
|
|
@ -59,6 +59,16 @@
|
|||
allowHTML,
|
||||
touch,
|
||||
trigger: 'mouseenter focusin',
|
||||
onShow: () => {
|
||||
const focused = document.activeElement;
|
||||
if (
|
||||
!tooltipElement?.matches(':hover') &&
|
||||
tooltipElement?.contains(focused) &&
|
||||
!focused?.matches(':focus-visible')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
...(theme !== '' ? { theme } : { theme: 'dark' }),
|
||||
arrow: false,
|
||||
offset,
|
||||
|
|
@ -74,7 +84,7 @@
|
|||
};
|
||||
|
||||
return {
|
||||
onShow: () => document.addEventListener('keydown', onKeyDown),
|
||||
onMount: () => document.addEventListener('keydown', onKeyDown),
|
||||
onHide: () => document.removeEventListener('keydown', onKeyDown),
|
||||
onDestroy: () => document.removeEventListener('keydown', onKeyDown)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue