Skip to content

Commit

Permalink
fix: update onFocusin
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Jun 29, 2022
1 parent c474181 commit 2ae697d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vuetify/src/components/VDialog/VDialog.ts
Expand Up @@ -233,17 +233,17 @@ export default baseMixins.extend<options>().extend({
if (
!!target &&
// It isn't the document or the dialog body
![document, this.$refs.content].includes(target) &&
![document, this.$refs.dialog].includes(target) &&
// It isn't inside the dialog body
!this.$refs.content.contains(target) &&
!this.$refs.dialog.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"])')
const focusable = this.$refs.dialog.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
const el = [...focusable].find(el => !el.hasAttribute('disabled')) as HTMLElement | undefined
el && el.focus()
}
Expand Down

0 comments on commit 2ae697d

Please sign in to comment.