Skip to content

Close unrelated auto popovers when a dialog opens inside a hint popover - #12764

Open
jakearchibald wants to merge 1 commit into
mainfrom
jakearchibald/fix-dialog-popover-hiding
Open

Close unrelated auto popovers when a dialog opens inside a hint popover#12764
jakearchibald wants to merge 1 commit into
mainfrom
jakearchibald/fix-dialog-popover-hiding

Conversation

@jakearchibald

@jakearchibald jakearchibald commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Commit message:


Close unrelated auto popovers when a dialog opens inside a hint popover

The algorithm the show-dialog methods were using was wrong. Light dismiss had the algorithm right. I've updated "hide popovers until" to use the light dismiss behaviour, and now light dismiss uses the "hide popovers until".


Fixes #12763.

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


/popover.html ( diff )

The dialog show() and show a modal dialog algorithms call hide popovers until with the dialog's topmost popover ancestor. When that ancestor was a hint popover, the algorithm returned after hiding the hint stack and left every auto popover open.

Light dismiss already handled this case: it hides auto popovers up to the document's hint stack parent, so the auto popovers the hint hangs off stay open and the rest close. Adopt that behaviour in hide popovers until, and have light dismiss call it instead of duplicating the two hide popover stack until calls.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the HTML popover dismissal algorithms so that when a dialog opens from within a hint popover, unrelated auto popovers are correctly closed (matching the behavior previously implemented in light dismiss), aligning spec behavior with the linked WPT expectations for #12763.

Changes:

  • Update hide popovers until to close auto popovers even when the endpoint is a hint popover, using the document’s hint stack parent as the auto-stack endpoint.
  • Refactor the light-dismiss pointer handling to reuse hide popovers until instead of duplicating the hide-stack logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source
Comment on lines +92540 to +92541
<p class="note">This means, if <var>endpoint</var> is a hint popover, auto popovers are closed,
except those that are parent to that hint popover.</p>

@jakearchibald jakearchibald Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure this helps. Anyone think otherwise?

@jakearchibald

Copy link
Copy Markdown
Contributor Author

Note that "hide popovers until" is exported and also called by the fullscreen API. I think this behaviour makes sense there too. I'll add a test.

@lukewarlow

Copy link
Copy Markdown
Member

This changing the behaviour for non-modal dialogs is perhaps a bit weird as they're in many ways like a manual popover.

@jakearchibald

Copy link
Copy Markdown
Contributor Author

Happy to discuss this at WHATNOT.

@jakearchibald jakearchibald added the agenda+ To be discussed at a triage meeting label Aug 6, 2026
@jakearchibald

Copy link
Copy Markdown
Contributor Author

Could folks review the tests? web-platform-tests/wpt#61795 - even if we tweak the behaviours it's good to know these look right, especially as it seems like the current tests were wrong, even before the spec change.

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

Labels

agenda+ To be discussed at a triage meeting

Development

Successfully merging this pull request may close these issues.

Opening a dialog within a hint popover

3 participants