Skip to content

Commit

Permalink
revert: fix(VDialog): focus the first child when tab leaves the dialog
Browse files Browse the repository at this point in the history
fixes #6892
This reverts commit 2d5d72b.
  • Loading branch information
KaelWD committed Jul 20, 2019
1 parent c70c078 commit 513cb56
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions packages/vuetify/src/components/VDialog/VDialog.js
Expand Up @@ -101,7 +101,6 @@ export default {
this.hideScroll()
} else {
this.removeOverlay()
this.unbind()
}
},
fullscreen (val) {
Expand Down Expand Up @@ -130,10 +129,6 @@ export default {
}
},

beforeDestroy () {
if (typeof window !== 'undefined') this.unbind()
},

methods: {
animateClick () {
this.animate = false
Expand Down Expand Up @@ -176,13 +171,6 @@ export default {
show () {
!this.fullscreen && !this.hideOverlay && this.genOverlay()
this.$refs.content.focus()
this.bind()
},
bind () {
window.addEventListener('focusin', this.onFocusin)
},
unbind () {
window.removeEventListener('focusin', this.onFocusin)
},
onKeydown (e) {
if (e.keyCode === keyCodes.esc && !this.getOpenDependents().length) {
Expand All @@ -196,25 +184,6 @@ export default {
}
this.$emit('keydown', e)
},
onFocusin (e) {
const { target } = e

if (
// It isn't the document or the dialog body
![document, this.$refs.content].includes(target) &&
// It isn't inside the dialog body
!this.$refs.content.contains(target) &&
// We're the topmost dialog
this.activeZIndex >= this.getMaxZIndex() &&
// It isn't inside a dependent element (like a menu)
!this.getOpenDependentElements().some(el => el.contains(target))
// So we must have focused something outside the dialog and its children
) {
// Find and focus the first available element inside the dialog
const focusable = this.$refs.content.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
focusable.length && focusable[0].focus()
}
},
getActivator (e) {
if (this.$refs.activator) {
return this.$refs.activator.children.length > 0
Expand Down

0 comments on commit 513cb56

Please sign in to comment.