Skip to content

Commit 28c808c

Browse files
committed
revert: fix(VDialog): focus the first child when tab leaves the dialog
fixes #6892 This reverts commit 2d5d72b.
1 parent 4ae06b1 commit 28c808c

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

packages/vuetify/src/components/VDialog/VDialog.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ export default {
101101
this.hideScroll()
102102
} else {
103103
this.removeOverlay()
104-
this.unbind()
105104
}
106105
},
107106
fullscreen (val) {
@@ -130,10 +129,6 @@ export default {
130129
}
131130
},
132131

133-
beforeDestroy () {
134-
if (typeof window !== 'undefined') this.unbind()
135-
},
136-
137132
methods: {
138133
animateClick () {
139134
this.animate = false
@@ -176,13 +171,6 @@ export default {
176171
show () {
177172
!this.fullscreen && !this.hideOverlay && this.genOverlay()
178173
this.$refs.content.focus()
179-
this.bind()
180-
},
181-
bind () {
182-
window.addEventListener('focusin', this.onFocusin)
183-
},
184-
unbind () {
185-
window.removeEventListener('focusin', this.onFocusin)
186174
},
187175
onKeydown (e) {
188176
if (e.keyCode === keyCodes.esc && !this.getOpenDependents().length) {
@@ -196,25 +184,6 @@ export default {
196184
}
197185
this.$emit('keydown', e)
198186
},
199-
onFocusin (e) {
200-
const { target } = e
201-
202-
if (
203-
// It isn't the document or the dialog body
204-
![document, this.$refs.content].includes(target) &&
205-
// It isn't inside the dialog body
206-
!this.$refs.content.contains(target) &&
207-
// We're the topmost dialog
208-
this.activeZIndex >= this.getMaxZIndex() &&
209-
// It isn't inside a dependent element (like a menu)
210-
!this.getOpenDependentElements().some(el => el.contains(target))
211-
// So we must have focused something outside the dialog and its children
212-
) {
213-
// Find and focus the first available element inside the dialog
214-
const focusable = this.$refs.content.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
215-
focusable.length && focusable[0].focus()
216-
}
217-
},
218187
getActivator (e) {
219188
if (this.$refs.activator) {
220189
return this.$refs.activator.children.length > 0

0 commit comments

Comments
 (0)