Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "hide all popovers until" algorithm #8963

Closed
nt1m opened this issue Mar 1, 2023 · 2 comments · Fixed by #8966
Closed

Issue with "hide all popovers until" algorithm #8963

nt1m opened this issue Mar 1, 2023 · 2 comments · Fixed by #8966
Labels
topic: popover The popover attribute and friends

Comments

@nt1m
Copy link
Member

nt1m commented Mar 1, 2023

To hide all popovers until, given an HTML element or Document endpoint, a boolean focusPreviousElement, and a boolean fireEvents:

  1. Let document be endpoint's node document.
  2. Let closeAllOpenPopovers be an algorithm which performs the following steps:
    1. Let popover be document's topmost auto popover.
    1. While popover is not null:
      1. Run the hide popover algorithm given popover, focusPreviousElement, fireEvents, and false.
      1. Set popover to document's topmost auto popover.
  3. If endpoint is null, then run closeAllOpenPopovers and return.

So "endpoint" can be null, so how does steps 1. & 2. get the document? Does that algorithm need to always take a document as extra argument?

cc @josepharhar @mfreed7 @domenic

@annevk annevk added the topic: popover The popover attribute and friends label Mar 1, 2023
@annevk
Copy link
Member

annevk commented Mar 1, 2023

Is there a way to hit that step?

Thinking about this again I think @josepharhar fixed the call sites to always pass an element or a document. And then probably forgot to remove that step.

If true, that also means closeAllOpenPopovers can be inlined now.

josepharhar added a commit to josepharhar/html that referenced this issue Mar 1, 2023
In whatwg#8886 I made the endpoint
parameter in hide all popovers until never null by making it either a
document or an element, but I forgot to change this null check to a
document check.

Fixes whatwg#8963
@josepharhar
Copy link
Contributor

Ah yes that was my mistake. It should be checking if endpoint is a document, not if endpoint is null. I opened a PR to fix it: #8966

annevk pushed a commit that referenced this issue Mar 1, 2023
In #8886 I made the endpoint parameter in hide all popovers until never null by making it either a document or an element, but I forgot to change this null check to a document check.

Fixes #8963.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: popover The popover attribute and friends
Development

Successfully merging a pull request may close this issue.

3 participants