Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should clicking a label contained in a button with popovertarget toggle the popover? #10431

Open
vinhill opened this issue Jun 25, 2024 · 0 comments

Comments

@vinhill
Copy link
Contributor

vinhill commented Jun 25, 2024

What is the issue with the HTML Standard?

In wpt, there is the test label-in-invoker and currently, all browsers pass it.

Here is a similar example

<button popovertarget=mypopover>
 <label>
  <input type=checkbox>
  label
</label>
</button>
<div id=mypopover popover=auto>popover</div>

The test case does not contain a checkbox and asserts the popover is toggled. Even with checkbox, all browsers toggle the popover and the checkbox.

In Blink, a recent change issue 41496122 ensured that clicking a label always dispatches a DOMActivate, which might trigger additional activation behavior. In Gecko, event flags are used to control whether other elements in the event chain should default handle the event.

Though this is not the specified behavior. During event dispatch, there is only one activation target, which should be label. Therefore, label should perform activation behavior by dispatching a click to its labeled content. The button should not perform activation behavior, i.e. not toggle the popover.

Activating both the label and button seems odd to me. Bug 1903257 describes similar odd cases, e.g. when nesting label with submit or reset buttons within forms. I'm wondering if there are reasons for having this behavior or whether the test and browsers should move towards only activating one of both.

This issue is blocking me on #10032. Implementations and the spec diverged on activation behavior, I prototyped with bringing Gecko and the spec closer to the implementations of Blink and WebKit by walking the event chain till an element default handles the event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants