diff options
Diffstat (limited to 'js/src/dom/selector-engine.js')
-rw-r--r-- | js/src/dom/selector-engine.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/src/dom/selector-engine.js b/js/src/dom/selector-engine.js index 381e45fe8b..88f9240762 100644 --- a/js/src/dom/selector-engine.js +++ b/js/src/dom/selector-engine.js @@ -11,6 +11,8 @@ * ------------------------------------------------------------------------ */ +import { isDisabled, isVisible } from '../util/index' + const NODE_TEXT = 3 const SelectorEngine = { @@ -69,6 +71,21 @@ const SelectorEngine = { } return [] + }, + + focusableChildren(element) { + const focusables = [ + 'a', + 'button', + 'input', + 'textarea', + 'select', + 'details', + '[tabindex]', + '[contenteditable="true"]' + ].map(selector => `${selector}:not([tabindex^="-"])`).join(', ') + + return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)) } } |