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

Why does popover hide when the popover attribute changed #10123

Closed
woody-li opened this issue Feb 4, 2024 · 4 comments
Closed

Why does popover hide when the popover attribute changed #10123

woody-li opened this issue Feb 4, 2024 · 4 comments
Labels
clarification Standard could be clearer topic: popover The popover attribute and friends

Comments

@woody-li
Copy link

woody-li commented Feb 4, 2024

What is the issue with the HTML Standard?

In https://html.spec.whatwg.org/multipage/popover.html#the-popover-attribute:concept-element-attributes-change-ext step 3:

If element's popover visibility state is in the showing state and oldValue and value are in different states, 
then run the hide popover algorithm given element, true, true, and false.

Why does popover need to be closed when the attribute changes between state enums?

I have a case: there's a global tooltip (implements with popover also) in popover (call it "X" alias).
When the X popover shown, then shows the global tooltip, the X popover auto closed.

So I try to change X popover to manual, but it closed when attribute changed.

@keithamus keithamus added clarification Standard could be clearer topic: popover The popover attribute and friends labels Feb 4, 2024
@keithamus
Copy link
Contributor

@josepharhar will be able to answer this succinctly.

@josepharhar
Copy link
Contributor

I think it would introduce complexity and unexpected states to allow switching between popover types without closing the popover. For example, we currently only allow multiple popover=auto popovers to be open if they are associated via a relationship, such as if one is a dom ancestor of another. If we allowed an unrelated popover to switch from popover=manual to popover=auto, should we close all other popover=auto popovers? If we don't then other algorithms would encounter an invalid state, and if we do then we have to add a bunch of partially duplicated code from the hide popover algorithm.

I have a case: there's a global tooltip (implements with popover also) in popover (call it "X" alias).
When the X popover shown, then shows the global tooltip, the X popover auto closed.

Why does your popover need to change states after opening? Why can't it just have popover=manual before it opens?

@woody-li
Copy link
Author

woody-li commented Feb 6, 2024

@josepharhar Thanks for your reply.
In my case, the popover and tooltip both needs light dismiss, so it setted as auto.
But when the tooltip shows, don't want to hide it.

So changed it's attribute from auto to manual when tooltip shows, and change back after closed.

Maybe the only case is tooltip, a global one without ancestor relationship to other elements.

@josepharhar
Copy link
Contributor

Ah I see your use case, it would be perfectly handled by the proposed popover=hint value:
#9776
#9778
I'm going to close this issue in favor of #9776
Please comment there if that proposal doesn't fit your use case in any way, but I believe it will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: popover The popover attribute and friends
Development

No branches or pull requests

3 participants