mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-29 11:31:19 +01:00
Fix modals hiding even if mousedown was triggered inside
This commit is contained in:
parent
ff6f5c5c57
commit
b1274aff6f
@ -25,9 +25,13 @@ export class Modal {
|
||||
$("[data-dismiss]", element)?.addEventListener("click", () => this.hide());
|
||||
|
||||
let mousedownTriggered = false;
|
||||
element.addEventListener("mousedown", () => (mousedownTriggered = true));
|
||||
element.addEventListener("click", (event) => {
|
||||
if (mousedownTriggered && event.target === element) {
|
||||
element.addEventListener("mousedown", (event) => {
|
||||
if (event.target !== element) {
|
||||
mousedownTriggered = true;
|
||||
}
|
||||
});
|
||||
element.addEventListener("click", () => {
|
||||
if (!mousedownTriggered) {
|
||||
this.hide();
|
||||
}
|
||||
mousedownTriggered = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user