Assignees
Labels
topic: popoverThe popover attribute and friends

Comments

@Gingeh

What is the issue with the HTML Standard?

Here's the problematic scenario:

<div popover="hint"></div>
<script>
const popover = document.querySelector("div");
popover.showPopover();
popover.setAttribute("popover","auto");
</script>

When the popover is shown, its opened in popover mode is set to "hint".
Upon changing the popover attribute:

  1. The popover attribute change steps say to run the hide popover algorithm.
  2. The hide popover steps eventually say If element's popover attribute is in the auto state or the hint state, then: Run hide all popovers until given element (step 7.1).
  3. The hide all popovers until steps eventually say If document's showing hint popover list contains endpoint: Assert: endpoint's popover attribute is in the hint state (step 6.1)
  4. That assertion fails because the popover's opened in popover mode is still "hint" (so it is in the document's showing hint popover list), but its popover attribute has been changed to "auto".
@Gingeh

After thinking about this, I think the hide popover algorithm should be using the popover's opened in popover mode instead of the current popover state.

@domenicdomenic added the agenda+To be discussed at a triage meetinglabel Feb 6, 2025
@mfreed7

After thinking about this, I think the hide popover algorithm should be using the popover's opened in popover mode instead of the current popover state.

Yep, I think this is the proper fix. Chromium indeed doesn't look at the attribute value, but instead the popover mode.

@pastpast removed the agenda+To be discussed at a triage meetinglabel Feb 7, 2025
@annevkannevk added the topic: popoverThe popover attribute and friendslabel Feb 21, 2025
@Gingeh

I'd love to submit a fix for this (and my other popover issues) but I can't contribute without publishing my full legal name, which I don't feel comfortable doing. (I believe it would also be legally dubious to give a to someone to submit on my behalf)
So I would really appreciate it if someone else could contribute these (fairly simple) fixes instead.

josepharhar added a commit to josepharhar/html that referenced this issue Apr 8, 2025
This PR prevents an assertion from being hit in hide all popovers until
by changing the conditions in which hide all popovers until gets called
by the hide popover algorithm to use the opened in popover mode instead
of looking at the current value of the popover attribute.

Fixes whatwg#10996
@josepharhar

Thanks for figuring this out! Here's a PR: #11197

Sign up for free to join this conversation on . Already have an account? Sign in to comment
topic: popoverThe popover attribute and friends

Successfully merging a pull request may close this issue.