Bug 210223 - <label> should treat any HTML element with a tabindex attribute as interactive content
Summary: <label> should treat any HTML element with a tabindex attribute as interactiv...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-08 15:58 PDT by Timothy Gu
Modified: 2020-04-13 12:32 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Gu 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
Comment 1 Radar WebKit Bug Importer 2020-04-08 16:25:52 PDT
<rdar://problem/61484026>
Comment 2 Timothy Gu 2020-04-13 12:32:24 PDT
This is apparently not web-compatible, according to https://crbug.com/1069615.