diff --git a/CHANGELOG.md b/CHANGELOG.md index c1adbf09..7f4fffdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - code editor: modern js operators such as `**` not recognized - sliders: prevent error when `steps` is not a number, add `auto` mode for using ranges values as steps (it did not work before) - pads, range: value not initialized as an array, causing errors in some cases + - modal: not closing properly when `doubleTap` is true ## 1.25.4 diff --git a/src/client/widgets/containers/modal.js b/src/client/widgets/containers/modal.js index d6c27735..7e8e2ce3 100644 --- a/src/client/widgets/containers/modal.js +++ b/src/client/widgets/containers/modal.js @@ -98,6 +98,16 @@ class Modal extends Panel { this.toggle = this.container.appendChild(html`
`) + var closer = DOM.get(this.popup, '.closer')[0] + + this.on('fast-click',(e)=>{ + console.log(e) + if ((e.target === this.popup || e.target === closer) && this.value == 1) { + e.detail.preventOriginalEvent = true + this.setValue(0, {sync:true, send:true}) + } + }, {element: this.container}) + if (this.getProp('doubleTap')) { doubleTap(this, ()=>{ this.setValue(1, {sync:true, send:true}) @@ -112,15 +122,6 @@ class Modal extends Panel { }, {element: this.container}) } - var closer = DOM.get(this.popup, '.closer')[0] - - this.on('fast-click',(e)=>{ - if ((e.target === this.popup || e.target === closer) && this.value == 1) { - e.detail.preventOriginalEvent = true - this.setValue(0, {sync:true, send:true}) - } - }, {element: this.container}) - this.escapeKeyHandler = ((e)=>{ if (e.keyCode==27) this.setValue(0, {sync:true, send:true})