Fixed #869 - Sidebar Mask not being removed from DOM

pull/880/head
Cagatay Civici 2021-01-20 11:43:46 +03:00
parent bb49c9fcf1
commit e6a02b264c
1 changed files with 10 additions and 5 deletions

View File

@ -54,7 +54,7 @@ export default {
mask: null, mask: null,
maskClickListener: null, maskClickListener: null,
beforeUnmount() { beforeUnmount() {
this.unbindMaskClickListener(); this.destroyModal();
}, },
methods: { methods: {
hide() { hide() {
@ -104,10 +104,7 @@ export default {
if (this.mask) { if (this.mask) {
DomHandler.addClass(this.mask, 'p-sidebar-mask-leave'); DomHandler.addClass(this.mask, 'p-sidebar-mask-leave');
this.mask.addEventListener('transitionend', () => { this.mask.addEventListener('transitionend', () => {
this.unbindMaskClickListener(); this.destroyModal();
document.body.removeChild(this.mask);
DomHandler.removeClass(document.body, 'p-overflow-hidden');
this.mask = null;
}); });
} }
}, },
@ -124,6 +121,14 @@ export default {
this.mask.removeEventListener('click', this.maskClickListener); this.mask.removeEventListener('click', this.maskClickListener);
this.maskClickListener = null; this.maskClickListener = null;
} }
},
destroyModal() {
if (this.mask) {
this.unbindMaskClickListener();
document.body.removeChild(this.mask);
DomHandler.removeClass(document.body, 'p-overflow-hidden');
this.mask = null;
}
} }
}, },
computed: { computed: {