-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This ensures that focus delegation, used by both delegatesFocus and <dialog>, does not traverse into non-delegatesFocus shadow trees. Otherwise you would get unintuitive results in situations such as the following: <div id="outer"> <#shadowroot delegatesFocus=true> <div id="inner> <#shadowroot delegatesFocus=false> <input> </#shadowroot> </div> </#shadowroot> </div> In such a scenario, with the previous specification, inner.focus() would not focus anything, since inner's shadow root does not delegate focus so we never hit the "focus delegate" algorithm. But outer.focus() would focus the <input> element, since with it having delegatesFocus=true, we use the "focus delegate" algorithm, which would look at all shadow-including descendants. After this change, both inner.focus() and outer.focus() would not focus anything, since the <input> is hidden inside a delegatesFocus=false shadow tree. Discovered in https://matrixlogs.bakkot.com/WHATWG/2021-11-23#L36-L62.
- Loading branch information
Showing
1 changed file
with
35 additions
and
19 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