whatwg / whatwg/html

When the popover attribute is removed, the hide popover algorithm will return too early

Open
#9,367 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: popover
Dominant language
HTML
Stars
9.4k
Forks
3.2k
Avg merge
3d 9h
Merged PRs (30d)
38

Description

Given https://github.com/whatwg/dom/pull/1176, the popover attribute is removed before running the element's attribute change steps.
Those steps are defined for the popover attribute: https://html.spec.whatwg.org/#attr-popover which in step 3 invoke the hide popover algorithm (https://html.spec.whatwg.org/#hide-popover-algorithm). That invokes checking the popover validity (https://html.spec.whatwg.org/#check-popover-validity) as its first step and if it returns false, returns early. The latter function checks in its first step, whether the element's popover attribute is in the "no popover state". Hence,

somePopoverElement.showPopover();
setTimeout(() => {
    somePopoverElement.removeAttribute("popover");
}, 1000);

will return early from the hide popover algorithm. Hence, the popover will remain open.

Seems related to https://github.com/whatwg/html/issues/9161 and https://github.com/whatwg/dom/pull/1185#issuecomment-1520926675

CC @josepharhar @jakearchibald @rwlbuis

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked DOM pull request and the HTML Standard sections for the popover attribute, hide popover algorithm, and check popover validity. Reproduce the shown showPopover/removeAttribute sequence, then trace the attribute-change and validity steps. Done means removing the popover attribute no longer leaves an open popover.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.