From 89e3850c5478c7bf0ae6081a95f6d2b39e690e8f Mon Sep 17 00:00:00 2001 From: Kael Date: Fri, 9 Sep 2022 01:16:04 +1000 Subject: [PATCH] fix(VDialog): don't try to focus tabindex="-1" or hidden inputs fixes #15745 --- packages/vuetify/src/components/VDialog/VDialog.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vuetify/src/components/VDialog/VDialog.ts b/packages/vuetify/src/components/VDialog/VDialog.ts index b85ba2d317d..84586a80659 100644 --- a/packages/vuetify/src/components/VDialog/VDialog.ts +++ b/packages/vuetify/src/components/VDialog/VDialog.ts @@ -234,8 +234,8 @@ export default baseMixins.extend({ // 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.dialog.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])') - const el = [...focusable].find(el => !el.hasAttribute('disabled')) as HTMLElement | undefined + const focusable = this.$refs.dialog.querySelectorAll('button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])') + const el = [...focusable].find(el => !el.hasAttribute('disabled') && !el.matches('[tabindex="-1"]')) as HTMLElement | undefined el && el.focus() } },