Skip to content

Commit

Permalink
Fixed #6779 - Drawer: dismissable mode behaviour defects
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Nov 13, 2024
1 parent d2d6d07 commit 142882f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/primevue/src/drawer/Drawer.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<Portal>
<div v-if="containerVisible" :ref="maskRef" @mousedown="onMaskClick" :class="cx('mask')" :style="sx('mask', true, { position })" v-bind="ptm('mask')">
<div v-if="containerVisible" :ref="maskRef" @mousedown="onMaskClick" :class="cx('mask')" :style="sx('mask', true, { position, modal })" v-bind="ptm('mask')">
<transition name="p-drawer" @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 :class="cx('root')" role="complementary" :aria-modal="modal" v-bind="ptmi('root')">
<div v-if="visible" :ref="containerRef" v-focustrap :class="cx('root')" :style="sx('root')" role="complementary" :aria-modal="modal" v-bind="ptmi('root')">
<slot v-if="$slots.container" name="container" :closeCallback="hide"></slot>
<template v-else>
<div :ref="headerContainerRef" :class="cx('header')" v-bind="ptm('header')">
Expand Down
11 changes: 7 additions & 4 deletions packages/primevue/src/drawer/style/DrawerStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const theme = ({ dt }) => `
.p-drawer {
display: flex;
flex-direction: column;
pointer-events: auto;
transform: translate3d(0px, 0px, 0px);
position: relative;
transition: transform 0.3s;
Expand Down Expand Up @@ -120,16 +119,20 @@ const theme = ({ dt }) => `
`;

const inlineStyles = {
mask: ({ position }) => ({
mask: ({ position, modal }) => ({
position: 'fixed',
height: '100%',
width: '100%',
left: 0,
top: 0,
display: 'flex',
justifyContent: position === 'left' ? 'flex-start' : position === 'right' ? 'flex-end' : 'center',
alignItems: position === 'top' ? 'flex-start' : position === 'bottom' ? 'flex-end' : 'center'
})
alignItems: position === 'top' ? 'flex-start' : position === 'bottom' ? 'flex-end' : 'center',
pointerEvents: modal ? 'auto' : 'none'
}),
root: {
pointerEvents: 'auto'
}
};

const classes = {
Expand Down

0 comments on commit 142882f

Please sign in to comment.