Bug 213982 - WebKit autofocuses the last available autofocus element instead of the first available
Summary: WebKit autofocuses the last available autofocus element instead of the first ...
Status: RESOLVED DUPLICATE of bug 203139
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-05 20:29 PDT by Maciej Stachowiak
Modified: 2020-09-26 15:25 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 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
Comment 1 Radar WebKit Bug Importer 2020-07-05 20:29:28 PDT
<rdar://problem/65116588>
Comment 2 Ryosuke Niwa 2020-09-26 15:25:25 PDT

*** This bug has been marked as a duplicate of bug 203139 ***