Bug 213982

Summary: WebKit autofocuses the last available autofocus element instead of the first available
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: cdumez, rniwa, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   

Maciej Stachowiak
Reported 2020-07-05 20:29:09 PDT
WebKit autofocuses the last available autofocus element instead of the first available. Other browsers autofocus the first. Here is a test case: https://mehdi.cc/tests/multiple-autofocus/ In Safari, this focuses Field 2. In Firefox and Chrome, Field 1. The spec says to autofocus the first. Well, sort of... autofocus for purposes of page load focus is only considered at element insertion time, not when the attribute is added or removed; and it's not the first element in document order that wins, it's the first (eligible) to be inserted. Full spec details are here: https://html.spec.whatwg.org/#the-autofocus-attribute
Attachments
Radar WebKit Bug Importer
Comment 1 2020-07-05 20:29:28 PDT
Ryosuke Niwa
Comment 2 2020-09-26 15:25:25 PDT
*** This bug has been marked as a duplicate of bug 203139 ***
Note You need to log in before you can comment on or make changes to this bug.