This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The section "6.2 Focus Navigation" [1] does not specify how the autofocus attribute [2] is to be handled if set on an element within a ShadowRoot. As of now Chrome and Firefox consider all elements at page load, including the ones in ShadowRoots when looking for an element with autofocus. That, however, is not the behavior I expected from an encapsulated DOM. What I expected is the same behavior the dialog element presents in showModal in steps 8 - 10 [3]. [1] http://w3c.github.io/webcomponents/spec/shadow/#focus-navigation [2] http://www.w3.org/html/wg/drafts/html/master/forms.html#autofocusing-a-form-control:-the-autofocus-attribute [3] http://www.w3.org/html/wg/drafts/html/master/interactive-elements.html#dom-dialog-showmodal
See also bug 26365.
To be clear, because the Shadow DOM spec doesn't *override* how autofocus works at all, the current behavior of Blink looks against the spec. autofocus is also on the radar on bug 26365.
Is it possible to add a note to the focus section saying that autofocus behavior should be the same as if the element with autofocus was a member of the document instead of a ShadowRoot? That wouldn't change current meaning, but make things a bit more clear (for authors, I guess)
Yes, we can. Looks the autofocus was mentioned at https://github.com/w3c/webcomponents/commit/b9f45ee237536f461a0526c1c0b070ac63c1ce6b. However, there is no mention at Focus Navigation section. We have to fix somehow.
Moved to https://github.com/w3c/webcomponents/issues/97