Simplify popover=hint behaviours & related spec fixes#12345
Conversation
|
I'll sort out the wrapping after reviews & changes. |
|
Btw https://github.com/domfarolino/specfmt is quite useful for the wrapping. |
|
@lukewarlow haha your deleted comment did reveal a bug! It wasn't the |
|
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. |
|
@mfreed7 can you create a PR for your tests so far? |
|
@mfreed7 a lovely bit of teamwork! I'm happy for this to land if you are? |
Totally agree - thanks for raising these issues, explaining them so clearly, and then working through the solutions. This feature got better/cleaner as a result. LGTM to land this. |
This patch updates the popover implementation to align with recent HTML spec changes, specifically regarding reentrancy protection and nested popover types. See the conversation in the spec PR: whatwg/html#12345 1. Strict Reentrancy Protection: Documents now maintain a `popover_showing` boolean and a `popover_hiding_nesting_count` integer to prevent concurrent popover toggles. If `showPopover()` is called while a popover is actively showing or hiding, a `DOMExceptionCode::kInvalidStateError` is immediately thrown. Stack-allocated `ScopedPopoverShowing` and `ScopedPopoverHiding` RAII helpers have been added to safely manage this state during `ShowPopoverInternal` and `HidePopoverInternal`. 2. Downgrading `popover=auto` to `popover=hint`: Previously, attempting to open an `auto` popover nested inside a `hint` popover threw an `InvalidStateError`. The spec now dictates that the `auto` popover should be permitted to open but with its effective type downgraded to `hint`. `ShowPopoverInternal` has been updated to omit the exception and coerce the incoming popover into the `hint_stack` so it appropriately assumes hint light-dismissal behaviors. Check invariants in `HideAllPopoversUntil` have been relaxed to handle this downgraded state safely. Tests in `external/wpt/html/semantics/popovers` have been updated to reflect the new expected behaviors. Bug: 499019927 Change-Id: Ibd6af063310585b9044de63a06e36ffd79d011d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7787494 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1620601}
Co-authored-by: Copilot <copilot@github.com>
|
@annevk looks like we're happy for this to land unless there's anything I'm missing? There have been a few changes since you last reviewed (sorry), in case you want to review again. (omg @domfarolino thanks so much for |
|
@jakearchibald OP appears incomplete. Note that after each edit (including checking a checkbox so best to not use the UI for that) you have to wait for the bot to update it as it will overwrite you otherwise. Also a bit unclear what the status of the tests is. |
This comment (#12345 (comment)) is still the state of things. I've left reply comments on the first PR, and the second two are still queued up in Chromium's infra waiting to be uploaded. As far as I'm concerned, yes, the new WPTs are all good. But I'm biased - I wrote them. Perhaps it'd be best to land all three of those PRs (which given the review hangups will likely take days) as-is, and then we can sort out any nits about the resulting state of tests? |
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}
…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
Commit message:
(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 )