mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
fix: allow toast notifications to be closed when a modal is open
The focus trap in the modal component was preventing clicks on elements outside of the modal, including the notification toasts. This change configures the focus trap to allow clicks on toast notifications, so they can be dismissed even when a modal is open.
This commit is contained in:
parent
ffad1f1dd1
commit
1e6426ed4f
1 changed files with 5 additions and 1 deletions
|
|
@ -57,7 +57,11 @@
|
||||||
|
|
||||||
$: if (show && modalElement) {
|
$: if (show && modalElement) {
|
||||||
document.body.appendChild(modalElement);
|
document.body.appendChild(modalElement);
|
||||||
focusTrap = FocusTrap.createFocusTrap(modalElement);
|
focusTrap = FocusTrap.createFocusTrap(modalElement, {
|
||||||
|
allowOutsideClick: (e) => {
|
||||||
|
return e.target.closest('[data-sonner-toast]') !== null;
|
||||||
|
}
|
||||||
|
});
|
||||||
focusTrap.activate();
|
focusTrap.activate();
|
||||||
window.addEventListener('keydown', handleKeyDown);
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
document.body.style.overflow = 'hidden';
|
document.body.style.overflow = 'hidden';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue