-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
7 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -988,7 +988,8 @@ function moveToEndOfArray(arr, condition) { | |
/** | ||
* Get the active or focused element in current DOM. | ||
* | ||
* Recursively search for the truly active or focused element incase there are shadow DOMs. | ||
* Recursively search for the truly active or focused element incase there are | ||
* shadow DOMs. | ||
* | ||
* @author Chen Jinlong <[email protected]> | ||
* | ||
|
@@ -998,11 +999,13 @@ function moveToEndOfArray(arr, condition) { | |
*/ | ||
function getActiveOrFocusedElement(root) { | ||
let curRoot = root || document; | ||
let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); | ||
let curActiveOrFocused = | ||
curRoot.activeElement || curRoot.querySelector(":focus"); | ||
|
||
while (curActiveOrFocused && curActiveOrFocused.shadowRoot) { | ||
curRoot = curActiveOrFocused.shadowRoot; | ||
curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); | ||
curActiveOrFocused = | ||
curRoot.activeElement || curRoot.querySelector(":focus"); | ||
} | ||
|
||
return curActiveOrFocused; | ||
|