Skip to content

Simplify popover=hint behaviours & related spec fixes#12345

Merged
annevk merged 32 commits into
mainfrom
jakearchibald/popover-hint-simpler-behaviours
May 14, 2026
Merged

Simplify popover=hint behaviours & related spec fixes#12345
annevk merged 32 commits into
mainfrom
jakearchibald/popover-hint-simpler-behaviours

Conversation

@jakearchibald
Copy link
Copy Markdown
Contributor

@jakearchibald jakearchibald commented Apr 8, 2026

Commit message:

Simplify popover=hint behaviors

- Showing a hint popover doesn't hide auto popovers.
- Showing a hint popover hides non-parent hint popovers.
- Clicking outside popovers consistently hides them.
- Hiding an auto popover does not hide unrelated hint popovers.
- Showing an auto popover as a child of a hint popover downgrades the auto popover to a hint.
- Showing a popover during the show or hide of another popover is no longer allowed.

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

Fixes #12304.

Fixes #12346.

Fixes #12355.

Fixes #12356.


/form-elements.html ( diff )
/infrastructure.html ( diff )
/interactive-elements.html ( diff )
/popover.html ( diff )

Comment thread source Outdated
@jakearchibald
Copy link
Copy Markdown
Contributor Author

jakearchibald commented Apr 8, 2026

I'll sort out the wrapping after reviews & changes.

@jakearchibald jakearchibald marked this pull request as ready for review April 8, 2026 14:01
@lukewarlow
Copy link
Copy Markdown
Member

Btw https://github.com/domfarolino/specfmt is quite useful for the wrapping.

@jakearchibald
Copy link
Copy Markdown
Contributor Author

@lukewarlow haha your deleted comment did reveal a bug! It wasn't the return false that was wrong, but I was missing a return true.

@jakearchibald
Copy link
Copy Markdown
Contributor Author

jakearchibald commented Apr 8, 2026

Edit: I've broken this out into #12355

av1.mp4

@mfreed7 sorry for another video, but I don't think I'd be able to describe it well. What do you see as the intended behaviour here?

https://random-stuff.jakearchibald.com/bug-repros/popover-show-on-hide-warning/ - here's the demo page.

Edit: I'm not convinced my spec totally solves this either, as hiding a popover hides child popovers, which would include the new ones added, and they'd be hidden with events. Maybe.

Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
@jakearchibald
Copy link
Copy Markdown
Contributor Author

@mfreed7 can you create a PR for your tests so far?

Comment thread source Outdated
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Return false.</p></li>
</ol>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
@annevk annevk merged commit 59e3d96 into main May 14, 2026
2 checks passed
@annevk annevk deleted the jakearchibald/popover-hint-simpler-behaviours branch May 14, 2026 09:37
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 14, 2026
See this discussion for more context:

whatwg/html#12304
whatwg/html#12345

This CL implements a simplified behavioral model for popover=hint and
popover=auto, cleanly separating the autoRootedPopoverStack from the
hintRootedPopoverStack and introducing a `hintStackParent` to track
where the hint stack branches off the auto stack.

The new behavior resolves the following inconsistencies (gated behind
the `PopoverHintNewBehavior` experimental runtime flag):

1. Opening a hint popover will not hide unrelated auto popovers.
2. Opening a hint popover closes only other non-ancestor hint
   popovers.
3. Clicking outside consistently closes both auto and hint popovers.
4. Hiding an auto popover closes only its child popovers.
5. Opening an auto popover inside a hint popover is disallowed and
   will fail.

A new WPT test (`popover-hint-hierarchy.html`) is added to explicitly
assert these 5 rules, and existing popover WPTs are updated to reflect
the new behavior. A virtual test suite (`popover-hint-old-behavior`)
is also added to continue testing the legacy behavior. I'm not sure
how to best handle the changed tests (and I guess the new test too)
in the context of a spec PR that is forthcoming. I'd like to be able
to publish (as a WPT PR at least) the changes, to help with the PR
effort. Suggestions appreciated.

A note about the diff: I made all of the feature flag checks look like
`if (!feature enabled) {` in the hopes that the old code would show
as unchanged in the diff, but gerrit's diff algorithm isn't great.
It's at least a little better like this than if I put the new code
first, so I left it.

Bug: 4990199
Change-Id: I41d8d96be71ba60ec5e7aa640c935258d1e33431
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7727959
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1615186}
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request May 15, 2026
…ior, a=testonly

Automatic update from web-platform-tests
Implement new/revised popover=hint behavior

See this discussion for more context:

whatwg/html#12304
whatwg/html#12345

This CL implements a simplified behavioral model for popover=hint and
popover=auto, cleanly separating the autoRootedPopoverStack from the
hintRootedPopoverStack and introducing a `hintStackParent` to track
where the hint stack branches off the auto stack.

The new behavior resolves the following inconsistencies (gated behind
the `PopoverHintNewBehavior` experimental runtime flag):

1. Opening a hint popover will not hide unrelated auto popovers.
2. Opening a hint popover closes only other non-ancestor hint
   popovers.
3. Clicking outside consistently closes both auto and hint popovers.
4. Hiding an auto popover closes only its child popovers.
5. Opening an auto popover inside a hint popover is disallowed and
   will fail.

A new WPT test (`popover-hint-hierarchy.html`) is added to explicitly
assert these 5 rules, and existing popover WPTs are updated to reflect
the new behavior. A virtual test suite (`popover-hint-old-behavior`)
is also added to continue testing the legacy behavior. I'm not sure
how to best handle the changed tests (and I guess the new test too)
in the context of a spec PR that is forthcoming. I'd like to be able
to publish (as a WPT PR at least) the changes, to help with the PR
effort. Suggestions appreciated.

A note about the diff: I made all of the feature flag checks look like
`if (!feature enabled) {` in the hopes that the old code would show
as unchanged in the diff, but gerrit's diff algorithm isn't great.
It's at least a little better like this than if I put the new code
first, so I left it.

Bug: 499019927
Change-Id: I41d8d96be71ba60ec5e7aa640c935258d1e33431
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7727959
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1615186}

--
Apply suggestion from @jakearchibald

Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
--
Undo changes to this file
--
Spaces
--
Apply suggestion from @jakearchibald

Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
--

wpt-commits: cf48cdceb7740ad09f521fb72b259d51cbb3f489, 36834da0c9a8370330208d84eed5abe092c11f11, b4d10cb3e66c1598e2f02a8d7106d3b34587b777, d1ee0b8ac21c4986aa60ef465e530ef0b76e7546, 7c5c87139d8080facb2095438372aa003b15e1f1
wpt-pr: 59237
caugner added a commit to mdn/browser-compat-data that referenced this pull request May 20, 2026
A large change was made to popover=hint to fix weird behaviours,
so the current implementations don't match the spec.

- Spec issue: whatwg/html#12304
- Spec PR: whatwg/html#12345

---------

Co-authored-by: Claas Augner <495429+caugner@users.noreply.github.com>
jonathan-j-lee pushed a commit to web-platform-tests/wpt that referenced this pull request May 21, 2026
…PT (#59955)

* Attempt to clean up the WPT export of popover=hint from Chromium to WPT

This PR pushes the latest state of `popover=hint` tests from Chromium
(prior to the landing of https://crrev.com/c/7851723, which was a
temporary stopgap to unbreak the infra) to WPT.

This one PR should completely replace any PRs that come out of
any still-unlanded PRs in this list:

whatwg/html#12345 (comment)

* Update test condition descriptions

Change-Id: I363b411aa8f6979fbde3766c27afe229703dfc1f
Change-Id: Ibd6af063310585b9044de63a06e36ffd79d011d4
Change-Id: I917bf939614f9811470444e9f13c942e5c63b1b1
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request May 27, 2026
…pover=hint from Chromium to WPT, a=testonly

Automatic update from web-platform-tests
Attempt to clean up the WPT export of popover=hint from Chromium to WPT (#59955)

* Attempt to clean up the WPT export of popover=hint from Chromium to WPT

This PR pushes the latest state of `popover=hint` tests from Chromium
(prior to the landing of https://crrev.com/c/7851723, which was a
temporary stopgap to unbreak the infra) to WPT.

This one PR should completely replace any PRs that come out of
any still-unlanded PRs in this list:

whatwg/html#12345 (comment)

* Update test condition descriptions

Change-Id: I363b411aa8f6979fbde3766c27afe229703dfc1f
Change-Id: Ibd6af063310585b9044de63a06e36ffd79d011d4
Change-Id: I917bf939614f9811470444e9f13c942e5c63b1b1
--

wpt-commits: 3dbd6f953f3099729b1fd2973bce27b0b7884212
wpt-pr: 59955
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request May 28, 2026
…pover=hint from Chromium to WPT, a=testonly

Automatic update from web-platform-tests
Attempt to clean up the WPT export of popover=hint from Chromium to WPT (#59955)

* Attempt to clean up the WPT export of popover=hint from Chromium to WPT

This PR pushes the latest state of `popover=hint` tests from Chromium
(prior to the landing of https://crrev.com/c/7851723, which was a
temporary stopgap to unbreak the infra) to WPT.

This one PR should completely replace any PRs that come out of
any still-unlanded PRs in this list:

whatwg/html#12345 (comment)

* Update test condition descriptions

Change-Id: I363b411aa8f6979fbde3766c27afe229703dfc1f
Change-Id: Ibd6af063310585b9044de63a06e36ffd79d011d4
Change-Id: I917bf939614f9811470444e9f13c942e5c63b1b1
--

wpt-commits: 3dbd6f953f3099729b1fd2973bce27b0b7884212
wpt-pr: 59955

UltraBlame original commit: a06780bbcfd57a4e6a05d6172f16d29ed039308f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request May 28, 2026
…pover=hint from Chromium to WPT, a=testonly

Automatic update from web-platform-tests
Attempt to clean up the WPT export of popover=hint from Chromium to WPT (#59955)

* Attempt to clean up the WPT export of popover=hint from Chromium to WPT

This PR pushes the latest state of `popover=hint` tests from Chromium
(prior to the landing of https://crrev.com/c/7851723, which was a
temporary stopgap to unbreak the infra) to WPT.

This one PR should completely replace any PRs that come out of
any still-unlanded PRs in this list:

whatwg/html#12345 (comment)

* Update test condition descriptions

Change-Id: I363b411aa8f6979fbde3766c27afe229703dfc1f
Change-Id: Ibd6af063310585b9044de63a06e36ffd79d011d4
Change-Id: I917bf939614f9811470444e9f13c942e5c63b1b1
--

wpt-commits: 3dbd6f953f3099729b1fd2973bce27b0b7884212
wpt-pr: 59955

UltraBlame original commit: a06780bbcfd57a4e6a05d6172f16d29ed039308f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request May 28, 2026
…pover=hint from Chromium to WPT, a=testonly

Automatic update from web-platform-tests
Attempt to clean up the WPT export of popover=hint from Chromium to WPT (#59955)

* Attempt to clean up the WPT export of popover=hint from Chromium to WPT

This PR pushes the latest state of `popover=hint` tests from Chromium
(prior to the landing of https://crrev.com/c/7851723, which was a
temporary stopgap to unbreak the infra) to WPT.

This one PR should completely replace any PRs that come out of
any still-unlanded PRs in this list:

whatwg/html#12345 (comment)

* Update test condition descriptions

Change-Id: I363b411aa8f6979fbde3766c27afe229703dfc1f
Change-Id: Ibd6af063310585b9044de63a06e36ffd79d011d4
Change-Id: I917bf939614f9811470444e9f13c942e5c63b1b1
--

wpt-commits: 3dbd6f953f3099729b1fd2973bce27b0b7884212
wpt-pr: 59955

UltraBlame original commit: a06780bbcfd57a4e6a05d6172f16d29ed039308f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants