mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-12 04:48:12 +02:00
Fix dialog closing when interacting with <select> child
https://discord.com/channels/1014774730907209781/1021695193499582494/1127653577360425042 'The.QCC: Embedding window. Switching between at end and at cursor closes the Embedding window'
This commit is contained in:
parent
6dfabb692d
commit
b4c3c4c650
@ -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…
x
Reference in New Issue
Block a user