Skip to content

Commit

Permalink
fix: fix the unexpected joggle state when dialog component non-fixed (
Browse files Browse the repository at this point in the history
  • Loading branch information
wangziling authored Aug 22, 2024
1 parent bdb20ab commit f97a108
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/primevue/src/dialog/Dialog.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<Portal :appendTo="appendTo">
<div v-if="containerVisible" :ref="maskRef" :class="cx('mask')" :style="sx('mask', true, { position, modal })" @mousedown="onMaskMouseDown" @mouseup="onMaskMouseUp" v-bind="ptm('mask')">
<transition name="p-dialog" @before-enter="onBeforeEnter" @enter="onEnter" @before-leave="onBeforeLeave" @leave="onLeave" @after-leave="onAfterLeave" appear v-bind="ptm('transition')">
<transition name="p-dialog" @before-enter="onBeforeEnter" @enter="onEnter" @after-enter="onAfterEnter" @before-leave="onBeforeLeave" @leave="onLeave" @after-leave="onAfterLeave" appear v-bind="ptm('transition')">
<div v-if="visible" :ref="containerRef" v-focustrap="{ disabled: !modal }" :class="cx('root')" :style="sx('root')" role="dialog" :aria-labelledby="ariaLabelledById" :aria-modal="modal" v-bind="ptmi('root')">
<slot v-if="$slots.container" name="container" :closeCallback="close" :maximizeCallback="(event) => maximize(event)"></slot>
<template v-else>
Expand Down Expand Up @@ -149,14 +149,16 @@ export default {
onEnter() {
this.$emit('show');
this.target = document.activeElement;
this.focus();
this.enableDocumentSettings();
this.bindGlobalListeners();
if (this.autoZIndex) {
ZIndex.set('modal', this.mask, this.baseZIndex + this.$primevue.config.zIndex.modal);
}
},
onAfterEnter() {
this.focus();
},
onBeforeLeave() {
if (this.modal) {
!this.isUnstyled && addClass(this.mask, 'p-overlay-mask-leave');
Expand Down

0 comments on commit f97a108

Please sign in to comment.