jquery-confirm
jquery-confirm copied to clipboard
Confirm closes when dragging cursor from inside to the background
jquery-confirm version: v3.3.2 (i don't think it is specific to any one version)
I'm submitting a ... [ x ] bug report [ ] feature request [ ] support request
Current behavior: The confirm closes if it has backgroundDismiss set to true and you drag your cursor from inside an input text element to the background of the confirm, the confirm will close.
Expected behavior: The confirm should not close.
Steps to reproduce: You have a confirm which has the backgroundDismiss property set to true. The content of the confirm is a form which contains at least an input text element. If you click inside the text element, then without releasing the mouse button, you drag the cursor outside the confirm, the confirm will close.
Other information: I think the reason for this behavior is highlighted on the click event page on MDN: link
If the button is pressed on one element and the pointer is moved outside the element before the button is released, the event is fired on the most specific ancestor element that contained both elements.
I think that a way to fix this would be to use the mousedown event to trigger the dismiss and when the actual click event triggers, which should dismiss the confirm, check that the element from mousedown is the same as the clicked target, and that it actually is the confirm.