Fixed #519 - TouchUI modal gets stuck if input tabs out

pull/548/head
Cagatay Civici 2020-10-10 14:23:45 +03:00
parent 355399f47d
commit 782d3f8ef6
1 changed files with 28 additions and 27 deletions

View File

@ -343,8 +343,7 @@ export default {
}
if (this.mask) {
this.disableModality();
this.mask = null;
this.destroyMask();
}
this.restoreAppend();
@ -554,6 +553,11 @@ export default {
this.unbindScrollListener();
this.unbindResizeListener();
this.$emit('hide');
if (this.mask) {
this.disableModality();
}
this.overlay = null;
},
onPrevButtonClick(event) {
@ -771,10 +775,6 @@ export default {
if (this.isSingleSelection() && (!this.showTime || this.hideOnDateTimeSelect)) {
setTimeout(() => {
this.overlayVisible = false;
if (this.mask) {
this.disableModality();
}
}, 150);
}
},
@ -1309,7 +1309,7 @@ export default {
DomHandler.addMultipleClasses(this.mask, 'p-datepicker-mask p-datepicker-mask-scrollblocker');
this.maskClickListener = () => {
this.disableModality();
this.overlayVisible = false;
};
this.mask.addEventListener('click', this.maskClickListener);
@ -1323,31 +1323,32 @@ export default {
},
disableModality() {
if (this.mask) {
this.overlayVisible = false;
DomHandler.addClass(this.mask, 'p-datepicker-mask-leave');
this.mask.addEventListener('transitionend', () => {
this.mask.removeEventListener('click', this.maskClickListener);
this.maskClickListener = null;
document.body.removeChild(this.mask);
this.mask = null;
let bodyChildren = document.body.children;
let hasBlockerMasks;
for (let i = 0; i < bodyChildren.length; i++) {
let bodyChild = bodyChildren[i];
if(DomHandler.hasClass(bodyChild, 'p-datepicker-mask-scrollblocker')) {
hasBlockerMasks = true;
break;
}
}
if (!hasBlockerMasks) {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
}
this.destroyMask();
});
}
},
destroyMask() {
this.mask.removeEventListener('click', this.maskClickListener);
this.maskClickListener = null;
document.body.removeChild(this.mask);
this.mask = null;
let bodyChildren = document.body.children;
let hasBlockerMasks;
for (let i = 0; i < bodyChildren.length; i++) {
let bodyChild = bodyChildren[i];
if(DomHandler.hasClass(bodyChild, 'p-datepicker-mask-scrollblocker')) {
hasBlockerMasks = true;
break;
}
}
if (!hasBlockerMasks) {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
}
},
updateCurrentMetaData() {
const viewDate = this.viewDate;
this.currentMonth = viewDate.getMonth();