You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dragging outside a modal (probably any dialog) it gets closed. The click event triggers on mouse up, and has the clientX & clientY from where the mouse was released.
Workaround/fix
I was able to fix this by adding this code inside dialogable.js:
if(this.options().clickOutside){letisInteractingInside=false;// Track mousedown events inside the dialogthis.el.addEventListener('mousedown',e=>{if(e.target!==this.el){isInteractingInside=true;}});// Reset the tracking on mouseupwindow.addEventListener('mouseup',()=>{setTimeout(()=>{isInteractingInside=false;},0);});// Clicking outside the dialog should close it...this.el.addEventListener('click',e=>{// Clicking the ::backdrop pseudo-element is treated the same as clicking the <dialog> element itself// Therefore, we can dissregard clicks on any element other than the <dialog> element itself...if(e.target!==this.el)return// Don't close if the interaction started inside the modalif(isInteractingInside)return// Again, because we can't listen for clicks on ::backdrop, we have to test for intersection// between the click and the visible parts of the dialog elements...if(clickHappenedOutside(this.el,e)){this.hide()e.preventDefault();e.stopPropagation()}})}
The text was updated successfully, but these errors were encountered:
Quick summary
When dragging outside a modal (probably any dialog) it gets closed. The click event triggers on mouse up, and has the clientX & clientY from where the mouse was released.
Workaround/fix
I was able to fix this by adding this code inside
dialogable.js
:The text was updated successfully, but these errors were encountered: