Skip to content

Commit db84347

Browse files
committed
fix(overlayable): get root element's z-index if activeIndex is not available
fixes #8473
1 parent 56edbdc commit db84347

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

packages/vuetify/src/components/VDialog/VDialog.sass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
pointer-events: none
3939
position: fixed
4040
top: 0
41-
transition: .2s map-get($transition, 'fast-in-fast-out')
41+
transition: .2s map-get($transition, 'fast-in-fast-out'), z-index 1ms
4242
width: 100%
4343
z-index: 6
4444
outline: none

packages/vuetify/src/components/VNavigationDrawer/VNavigationDrawer.sass

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,13 @@
111111
.v-list-group--sub-group
112112
display: none
113113

114-
.v-navigation-drawer--temporary,
115-
.v-navigation-drawer--is-mobile
114+
.v-navigation-drawer--temporary
115+
z-index: 7
116+
117+
.v-navigation-drawer--mobile
116118
z-index: 6
117119

120+
.v-navigation-drawer--is-mobile,
121+
.v-navigation-drawer--temporary
118122
&:not(.v-navigation-drawer--close)
119123
+elevation(16)

packages/vuetify/src/components/VOverlay/VOverlay.sass

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
right: 0
1717
bottom: 0
1818
pointer-events: none
19-
transition: $primary-transition
19+
transition: $primary-transition, z-index 1ms
2020

2121
// Element
2222
.v-overlay__content
@@ -30,7 +30,7 @@
3030
position: absolute
3131
right: 0
3232
top: 0
33-
transition: .3s cubic-bezier(.25,.8,.50,1)
33+
transition: inherit
3434
width: 100%
3535
will-change: opacity
3636

packages/vuetify/src/mixins/overlayable/__tests__/overlayable.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,17 @@ describe('Overlayable.ts', () => {
5858
wrapper.vm.overlay.$el.dispatchEvent(event)
5959
expect(wrapper.vm.overlay).toBeFalsy()
6060
})
61+
62+
// https://github.com/vuetifyjs/vuetify/issues/8473
63+
it('should get root element z-index if activeIndex is not available', async () => {
64+
const wrapper = mountFunction()
65+
66+
wrapper.vm.$el.style.zIndex = 8
67+
68+
wrapper.vm.genOverlay()
69+
70+
await new Promise(resolve => window.requestAnimationFrame(resolve))
71+
72+
expect(wrapper.vm.overlay.zIndex).toBe(8)
73+
})
6174
})

packages/vuetify/src/mixins/overlayable/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
import VOverlay from '../../components/VOverlay'
33

44
// Utilities
5-
import { keyCodes, addOnceEventListener, addPassiveEventListener } from '../../util/helpers'
5+
import {
6+
keyCodes,
7+
addOnceEventListener,
8+
addPassiveEventListener,
9+
getZIndex,
10+
} from '../../util/helpers'
611

712
// Types
813
import Vue from 'vue'
@@ -79,6 +84,8 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({
7984

8085
if (this.activeZIndex !== undefined) {
8186
this.overlay.zIndex = String(this.activeZIndex - 1)
87+
} else if (this.$el) {
88+
this.overlay.zIndex = getZIndex(this.$el)
8289
}
8390

8491
this.overlay.value = true

0 commit comments

Comments
 (0)