From 94f31d274a488c8023282f25b47cbd88cd732448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Wed, 10 May 2023 09:25:59 +0300 Subject: [PATCH] Refactor findFocusableElement --- components/lib/dialog/Dialog.vue | 2 +- components/lib/sidebar/Sidebar.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lib/dialog/Dialog.vue b/components/lib/dialog/Dialog.vue index f7aa53de6..93ff2587c 100755 --- a/components/lib/dialog/Dialog.vue +++ b/components/lib/dialog/Dialog.vue @@ -268,7 +268,7 @@ export default { }, focus() { const findFocusableElement = (container) => { - return container.querySelector('[autofocus]'); + return container && container.querySelector('[autofocus]'); }; let focusTarget = this.$slots.footer && findFocusableElement(this.footerContainer); diff --git a/components/lib/sidebar/Sidebar.vue b/components/lib/sidebar/Sidebar.vue index acde9e6f5..534513408 100755 --- a/components/lib/sidebar/Sidebar.vue +++ b/components/lib/sidebar/Sidebar.vue @@ -138,7 +138,7 @@ export default { }, focus() { const findFocusableElement = (container) => { - return container.querySelector('[autofocus]'); + return container && container.querySelector('[autofocus]'); }; let focusTarget = this.$slots.default && findFocusableElement(this.content);