From 760c98f9981683caee4b40adba321d4f385d223a Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 10 Jun 2024 10:44:46 +0300 Subject: [PATCH] Refactor #5577 --- components/lib/confirmpopup/ConfirmPopup.vue | 9 ++++----- components/lib/dialog/Dialog.vue | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/components/lib/confirmpopup/ConfirmPopup.vue b/components/lib/confirmpopup/ConfirmPopup.vue index 92d699e4b..0f4eef256 100644 --- a/components/lib/confirmpopup/ConfirmPopup.vue +++ b/components/lib/confirmpopup/ConfirmPopup.vue @@ -55,7 +55,7 @@ export default { confirmation: null, autoFocusAccept: null, autoFocusReject: null, - focusElementOnHide: null + target: null }; }, target: null, @@ -151,8 +151,7 @@ export default { onEnter(el) { this.autoFocusAccept = this.confirmation.defaultFocus === undefined || this.confirmation.defaultFocus === 'accept' ? true : false; this.autoFocusReject = this.confirmation.defaultFocus === 'reject' ? true : false; - - this.focusElementOnHide = document.activeElement; + this.target = document.activeElement; this.bindOutsideClickListener(); this.bindScrollListener(); @@ -167,8 +166,8 @@ export default { this.autoFocusAccept = null; this.autoFocusReject = null; - DomHandler.focus(this.focusElementOnHide); - this.focusElementOnHide = null; + DomHandler.focus(this.target); + this.target = null; this.unbindOutsideClickListener(); this.unbindScrollListener(); diff --git a/components/lib/dialog/Dialog.vue b/components/lib/dialog/Dialog.vue index 6a71589fe..31f4bf890 100755 --- a/components/lib/dialog/Dialog.vue +++ b/components/lib/dialog/Dialog.vue @@ -85,7 +85,7 @@ export default { maximized: false, focusableMax: null, focusableClose: null, - focusElementOnHide: null + target: null }; }, watch: { @@ -140,7 +140,7 @@ export default { }, onEnter() { this.$emit('show'); - this.focusElementOnHide = document.activeElement; + this.target = document.activeElement; this.focus(); this.enableDocumentSettings(); this.bindGlobalListeners(); @@ -156,8 +156,8 @@ export default { }, onLeave() { this.$emit('hide'); - DomHandler.focus(this.focusElementOnHide); - this.focusElementOnHide = null; + DomHandler.focus(this.target); + this.target = null; this.focusableClose = null; this.focusableMax = null; },