BlockScroll feature added

pull/3465/head
Bahadır Sofuoğlu 2023-01-03 17:35:38 +03:00
parent 80e3981e92
commit 2302dc4206
1 changed files with 7 additions and 1 deletions

View File

@ -64,7 +64,7 @@ export default {
}, },
blockScroll: { blockScroll: {
type: Boolean, type: Boolean,
default: false default: true
} }
}, },
maskClickListener: null, maskClickListener: null,
@ -95,7 +95,9 @@ export default {
methods: { methods: {
hide() { hide() {
this.$emit('update:visible', false); this.$emit('update:visible', false);
this.outsideClickListener && this.unbindOutsideClickListener(); this.outsideClickListener && this.unbindOutsideClickListener();
this.blockScroll && DomHandler.removeClass(document.body, 'p-overflow-hidden');
}, },
onEnter() { onEnter() {
this.$emit('show'); this.$emit('show');
@ -120,6 +122,10 @@ export default {
}, },
onAfterEnter() { onAfterEnter() {
this.bindOutsideClickListener(); this.bindOutsideClickListener();
if (this.blockScroll) {
DomHandler.addClass(document.body, 'p-overflow-hidden');
}
}, },
focus() { focus() {
const findFocusableElement = (container) => { const findFocusableElement = (container) => {