From 7e66c9c37b12234d05f7413bf524a48ea1df4056 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Wed, 27 May 2020 15:53:10 +0300 Subject: [PATCH] Revert "Merge pull request #310 from ajacob/fix-dialog-focus" This reverts commit d8e2223e174eef684a67591234b6bd90bbacf275, reversing changes made to 34898463769241088d8b2de08564df525e4255d6. --- src/components/dialog/Dialog.vue | 6 +++--- src/components/utils/DomHandler.js | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/dialog/Dialog.vue b/src/components/dialog/Dialog.vue index b7c4f9b41..8030a2ec6 100755 --- a/src/components/dialog/Dialog.vue +++ b/src/components/dialog/Dialog.vue @@ -122,9 +122,9 @@ export default { } }, focus() { - let focusableElements = DomHandler.getFocusableElements(this.$refs.dialog); - if (focusableElements && focusableElements.length > 0) { - focusableElements[0].focus(); + let focusable = DomHandler.findSingle(this.$refs.dialog, 'input,button'); + if (focusable) { + focusable.focus(); } }, maximize() { diff --git a/src/components/utils/DomHandler.js b/src/components/utils/DomHandler.js index 7b14a5035..9e97c3e8f 100755 --- a/src/components/utils/DomHandler.js +++ b/src/components/utils/DomHandler.js @@ -401,10 +401,10 @@ export default class DomHandler { } static getFocusableElements(element) { - let focusableElements = DomHandler.find(element, `button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), - [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]):not([aria-label = "close"]), - input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), - textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), + let focusableElements = DomHandler.find(element, `button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), + [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), + input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), + textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])` ); @@ -427,4 +427,4 @@ export default class DomHandler { this.hasClass(element.parentElement, 'p-checkbox') || this.hasClass(element.parentElement, 'p-radiobutton') ); } -} +} \ No newline at end of file