From 5f5c7c6addca0c774ee56b3499feb6a73d159072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 10 Mar 2023 14:17:30 +0300 Subject: [PATCH] Fixed #3729 - Dialog: header buttons autofocus defect --- components/dialog/Dialog.vue | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/components/dialog/Dialog.vue b/components/dialog/Dialog.vue index a06040c62..19bc83445 100755 --- a/components/dialog/Dialog.vue +++ b/components/dialog/Dialog.vue @@ -8,10 +8,20 @@ {{ header }}
- -
@@ -155,7 +165,8 @@ export default { return { containerVisible: this.visible, maximized: false, - focusable: false + focusableMax: null, + focusableClose: null }; }, documentKeydownListener: null, @@ -218,7 +229,8 @@ export default { }, onLeave() { this.$emit('hide'); - this.focusable = false; + this.focusableClose = null; + this.focusableMax = null; }, onAfterLeave() { if (this.autoZIndex) { @@ -249,14 +261,19 @@ export default { focusTarget = this.$slots.default && findFocusableElement(this.content); if (!focusTarget) { - focusTarget = findFocusableElement(this.container); + if (this.maximizable) { + this.focusableMax = true; + focusTarget = this.maximizableButton; + } else { + this.focusableClose = true; + focusTarget = this.closeButton; + } } } } if (focusTarget) { - this.focusable = true; - focusTarget.focus(); + DomHandler.focus(focusTarget); } }, maximize(event) {