This file contains 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
/** | |
* @param {!Element=} | |
* @return {!Array<!Element>} containing focused element, deepest first | |
*/ | |
function getActive(t = document.activeElement || document.body) { | |
if (t.activeElement) { | |
t = t.activeElement; | |
} | |
if (t.shadowRoot) { | |
return [...getActive(t.shadowRoot), t]; | |
} | |
return [t]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment