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

Fix corner case invoker issue with popover nested inside invoker #10770

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mfreed7
Copy link
Contributor

@mfreed7 mfreed7 commented Nov 16, 2024

In this situation:

<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>

clicking the button properly activates the popover, however, clicking on the popover itself after that should not close the popover. It currently does, because the popover click bubbles to the <button> and activates the invoker, which toggles the popover closed.

This patch fixes that case by checking that the invoke event wasn't on the popover itself.

(See WHATWG Working Mode: Changes for more details.)


/form-elements.html ( diff )
/input.html ( diff )
/popover.html ( diff )

In this situation:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however, clicking on the popover itself after that should **not** close the popover. It currently does because the popover click bubbles to the `<button>` and activates the invoker, which toggles the popover closed.

This patch fixes that case.
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
Copy link
Contributor Author

@mfreed7 mfreed7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 18, 2024
In this case:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however,
clicking on the popover itself after that should **not** close
the popover. It currently does because the popover click
bubbles to the `<button>` and activates the invoker, which
toggles the popover closed.

This CL changes that behavior so that clicks on the popover
in the case above no longer re-invoke the popover.

Spec PR:
  whatwg/html#10770

Bug: 379241451
Change-Id: Iab67127c46a97a081a7818bfd917864729bf8b5c
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 18, 2024
In this case:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however,
clicking on the popover itself after that should **not** close
the popover. It currently does because the popover click
bubbles to the `<button>` and activates the invoker, which
toggles the popover closed.

This CL changes that behavior so that clicks on the popover
in the case above no longer re-invoke the popover.

Spec PR:
  whatwg/html#10770

Bug: 379241451
Change-Id: Iab67127c46a97a081a7818bfd917864729bf8b5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6026982
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: David Baron <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1384498}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 18, 2024
In this case:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however,
clicking on the popover itself after that should **not** close
the popover. It currently does because the popover click
bubbles to the `<button>` and activates the invoker, which
toggles the popover closed.

This CL changes that behavior so that clicks on the popover
in the case above no longer re-invoke the popover.

Spec PR:
  whatwg/html#10770

Bug: 379241451
Change-Id: Iab67127c46a97a081a7818bfd917864729bf8b5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6026982
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: David Baron <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1384498}
mfreed7 added a commit to mfreed7/wpt that referenced this pull request Nov 18, 2024
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 20, 2024
…ained within invokers, a=testonly

Automatic update from web-platform-tests
Implement new behavior for popovers contained within invokers

In this case:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however,
clicking on the popover itself after that should **not** close
the popover. It currently does because the popover click
bubbles to the `<button>` and activates the invoker, which
toggles the popover closed.

This CL changes that behavior so that clicks on the popover
in the case above no longer re-invoke the popover.

Spec PR:
  whatwg/html#10770

Bug: 379241451
Change-Id: Iab67127c46a97a081a7818bfd917864729bf8b5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6026982
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: David Baron <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1384498}

--

wpt-commits: 50f7c0548260cdc2f11bface1816a283f9314de8
wpt-pr: 49232
@domenic domenic added normative change topic: popover The popover attribute and friends labels Nov 21, 2024
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; will let @annevk review again if he's interested, and then we can merge when the template is filled out.

source Show resolved Hide resolved
@mfreed7
Copy link
Contributor Author

mfreed7 commented Nov 21, 2024

LGTM; will let @annevk review again if he's interested, and then we can merge when the template is filled out.

Thanks! I filled out the rest of the template.

i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Nov 21, 2024
…ained within invokers, a=testonly

Automatic update from web-platform-tests
Implement new behavior for popovers contained within invokers

In this case:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however,
clicking on the popover itself after that should **not** close
the popover. It currently does because the popover click
bubbles to the `<button>` and activates the invoker, which
toggles the popover closed.

This CL changes that behavior so that clicks on the popover
in the case above no longer re-invoke the popover.

Spec PR:
  whatwg/html#10770

Bug: 379241451
Change-Id: Iab67127c46a97a081a7818bfd917864729bf8b5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6026982
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: David Baron <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1384498}

--

wpt-commits: 50f7c0548260cdc2f11bface1816a283f9314de8
wpt-pr: 49232
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Nov 22, 2024
…ained within invokers, a=testonly

Automatic update from web-platform-tests
Implement new behavior for popovers contained within invokers

In this case:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however,
clicking on the popover itself after that should **not** close
the popover. It currently does because the popover click
bubbles to the `<button>` and activates the invoker, which
toggles the popover closed.

This CL changes that behavior so that clicks on the popover
in the case above no longer re-invoke the popover.

Spec PR:
  whatwg/html#10770

Bug: 379241451
Change-Id: Iab67127c46a97a081a7818bfd917864729bf8b5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6026982
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: David Baron <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1384498}

--

wpt-commits: 50f7c0548260cdc2f11bface1816a283f9314de8
wpt-pr: 49232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
normative change topic: popover The popover attribute and friends
Development

Successfully merging this pull request may close these issues.

3 participants