Bug 210223

Summary: <label> should treat any HTML element with a tabindex attribute as interactive content
Product: WebKit Reporter: Timothy Gu <timothygu99>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: cdumez, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Timothy Gu
Reported 2020-04-08 15:58:04 PDT
Consider: <!DOCTYPE html> <label> <button onclick="alert('bad')">Don't click</button> <div tabindex="0">Click</div> </label> When one clicks on the div with tabindex attribute, the button gets clicked. But it should not, as the div should be considered interactive content [1], and the HTML Standard says that the activation behavior of the label [2] with events targeted at interactive content descendants of label must be a no-op. Previously Chrome and Firefox behaves similarly to Chrome, but whatwg/html#5414 [3] reaffirms the spec, and Chromium CL 2122369 [4] implements the spec behavior. I plan to implement this change in Firefox as well [5]. We should align once Chrome ship this change. More tests are available at [6]. [1]: https://html.spec.whatwg.org/C/#interactive-content-2 [2]: https://html.spec.whatwg.org/C/#the-label-element:activation-behaviour-2 [3]: https://github.com/whatwg/html/issues/5414 [4]: https://chromium-review.googlesource.com/c/chromium/src/+/2122369 [5]: https://bugzilla.mozilla.org/show_bug.cgi?id=1628500 [6]: https://github.com/web-platform-tests/wpt/pull/22749
Attachments
Radar WebKit Bug Importer
Comment 1 2020-04-08 16:25:52 PDT
Timothy Gu
Comment 2 2020-04-13 12:32:24 PDT
This is apparently not web-compatible, according to https://crbug.com/1069615.
Note You need to log in before you can comment on or make changes to this bug.