Menubar mobile outside click defect

pull/4101/head^2
Tuğçe Küçükoğlu 2023-07-04 17:11:19 +03:00
parent 73375d1555
commit 53f1a6973e
1 changed files with 4 additions and 3 deletions

View File

@ -134,7 +134,7 @@ export default {
ZIndexUtils.set('menu', this.menubar, this.$primevue.config.zIndex.menu); ZIndexUtils.set('menu', this.menubar, this.$primevue.config.zIndex.menu);
setTimeout(() => { setTimeout(() => {
this.show(); this.show();
}, 0); }, 1);
} }
this.bindOutsideClickListener(); this.bindOutsideClickListener();
@ -147,6 +147,7 @@ export default {
}, },
hide(event, isFocus) { hide(event, isFocus) {
if (this.mobileActive) { if (this.mobileActive) {
this.mobileActive = false;
setTimeout(() => { setTimeout(() => {
DomHandler.focus(this.$refs.menubutton); DomHandler.focus(this.$refs.menubutton);
}, 0); }, 0);
@ -419,8 +420,8 @@ export default {
const isOutsideContainer = this.menubar !== event.target && !this.menubar.contains(event.target); const isOutsideContainer = this.menubar !== event.target && !this.menubar.contains(event.target);
const isOutsideMenuButton = this.mobileActive && this.$refs.menubutton !== event.target && !this.$refs.menubutton.contains(event.target); const isOutsideMenuButton = this.mobileActive && this.$refs.menubutton !== event.target && !this.$refs.menubutton.contains(event.target);
if (isOutsideContainer) { if (isOutsideMenuButton && isOutsideContainer) {
isOutsideMenuButton ? (this.mobileActive = false) : this.hide(); this.hide();
} }
}; };