mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-01-23 14:50:54 +01:00
Merge pull request #1396 from JeLuF/dlgclose
Fix dialog closing when interacting with <select> child
This commit is contained in:
commit
837ad5b68c
@ -1074,6 +1074,12 @@ async function deleteKeys(keyToDelete) {
|
||||
|
||||
function modalDialogCloseOnBackdropClick(dialog) {
|
||||
dialog.addEventListener('mousedown', function (event) {
|
||||
// Firefox creates an event with clientX|Y = 0|0 when choosing an <option>.
|
||||
// Test whether the element interacted with is a child of the dialog, but not the
|
||||
// dialog itself (the backdrop would be a part of the dialog)
|
||||
if (dialog.contains(event.target) && dialog != event.target) {
|
||||
return
|
||||
}
|
||||
var rect = dialog.getBoundingClientRect()
|
||||
var isInDialog=(rect.top <= event.clientY && event.clientY <= rect.top + rect.height
|
||||
&& rect.left <= event.clientX && event.clientX <= rect.left + rect.width)
|
||||
|
Loading…
Reference in New Issue
Block a user