[webcomponents] [Shadow]: how is the autofocus attribute supposed to be handled? (bugzilla: 27757) (#97)

Title: [Shadow]: how is the autofocus attribute supposed to be handled? (bugzilla: 27757)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757

----
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c0
*Rodney Rehm* wrote on 2015-01-05 21:23:37 +0000.

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

----

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c1
*Hayato Ito* wrote on 2015-01-06 01:03:17 +0000.

See also bug 26365.

----

comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c2
*Hayato Ito* wrote on 2015-01-07 04:37:59 +0000.

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.

----

comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c3
*Rodney Rehm* wrote on 2015-01-07 08:21:06 +0000.

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)

----

comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c4
*Hayato Ito* wrote on 2015-04-15 06:30:18 +0000.

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.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/97

Received on Monday, 25 May 2015 08:51:57 UTC