modal/popup: prevent touch event from affecting elements behind the popup when closing it (#228)

This commit is contained in:
jean-emmanuel 2018-03-12 10:24:53 +01:00
parent ce7fa242b9
commit 303a895df0
3 changed files with 5 additions and 1 deletions

View file

@ -36,7 +36,8 @@ module.exports = {
`)
if (this.closable) {
DOM.get(this.html, '.popup-title .closer')[0].addEventListener('fast-click', ()=>{
DOM.get(this.html, '.popup-title .closer')[0].addEventListener('fast-click', (e)=>{
e.detail.preventDefault = true
this.close()
})
}

View file

@ -81,6 +81,7 @@ module.exports = class Modal extends Panel {
this.popup.style.setProperty('--height', height)
DOM.get(this.popup, '.closer')[0].addEventListener('fast-click', (e)=>{
e.detail.preventDefault = true
this.setValue(0, {sync:true, send:true})
})
@ -99,6 +100,7 @@ module.exports = class Modal extends Panel {
this.popup.addEventListener('fast-click',(e)=>{
if (e.target == this.popup && this.value == 1) {
e.detail.preventDefault = true
this.setValue(0, {sync:true, send:true})
}
})