This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isVisible(element) { | |
| const style = window.getComputedStyle(element); | |
| return style.display !== 'none'; | |
| } | |
| function isFocusable (element) { | |
| const focusableElements = [ | |
| 'a[href]', | |
| 'button:enabled', | |
| 'input:enabled', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setFocusIfFocusable(node) { | |
| if (node.nodeType !== Node.ELEMENT_NODE) { | |
| // Text and comment nodes aren't focusable. | |
| return false; | |
| } | |
| if (node.disabled === true) { | |
| // Disabled elements can't be focused. | |
| return false; | |
| } |