This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27912 - initial focus precedence: autofocus or fragment identifier
Summary: initial focus precedence: autofocus or fragment identifier
Status: RESOLVED MOVED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P1 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-27 23:30 UTC by Rodney Rehm
Modified: 2016-04-27 16:52 UTC (History)
4 users (show)

See Also:


Attachments

Description Rodney Rehm 2015-01-27 23:30:09 UTC
There are currently at least 2 ways to set initial focus upon document load. The document itself can define an element to (scroll to and) focus by using the autofocus attribute [1] (limited to form elements). The user can define the element to (scroll to and) focus by using a URL fragment identifier [2]. The specification does not define order of processing autofocus and fragment identifiers. 

Blink [3] prefers the autofocus attribute. Gecko [4] and WebKit [5] prefer :target but show bugs in doing so. Trident (IE11) prefers :target without bugs.

In my opinion Microsoft got this one right. A URL fragment identifier can be argued to be user-input, where autofocus is a document's default state. User input should be more important. I propose to add a note to the autofocus [1] spec saying that fragment identifiers [2] have precedence.


[1] http://www.w3.org/html/wg/drafts/html/master/forms.html#autofocusing-a-form-control:-the-autofocus-attribute
[2] http://www.w3.org/html/wg/drafts/html/master/browsers.html#scroll-to-fragid
[3] https://code.google.com/p/chromium/issues/detail?id=382901
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=840187
[5] https://bugs.webkit.org/show_bug.cgi?id=140963
Comment 1 Michael[tm] Smith 2015-06-16 11:11:48 UTC
Re-prioritizing per implementer feedback but noting this us simply editorial.
Comment 2 Arron Eicholz 2016-04-27 16:52:20 UTC
HTML5.1 Bugzilla Bug Triage: Moved to Github issue: https://github.com/w3c/html/issues/277

To file additional issues please use the W3C HTML5 Issue tracker: https://github.com/w3c/html/issues/new Thanks!