-
Notifications
You must be signed in to change notification settings - Fork 715
[selectors-4] Introduce :popovertarget-open pseudo class #9547
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
Comments
Just to note: Meaning that the selector name would be different. And that other |
Looks like the explainer for invoketarget might use |
It would in the accessibility API. But this wouldn't be an attribute which could be selected with CSS. So a new pseudo-class selector for this would still be needed |
cc @keithamus if you have ideas of what can be done here. I would think :has(:popover-open) + a certain DOM structure makes this possible. Having something more generic for invokers would require a precise definition. |
I am not that familiar with the accessibility API, but if |
We shouldn't have to rely on adding the elements next to each other or in a specific container, etc. The power of the popover api allows us to have the elements separate from each other. At which point we would need a way to know if the invokers target has been changed. As far as a precise definition as long as they contain |
With the invokers proposal, I wonder if we should have a :invoketarget() function that takes a selector to match against.
Implementing invalidation for something like this would probably involved though (imagine all the combinations like |
Every HTML element is internally mapped to ARIA role and state(s). Where these properties are then communicated to assistive technologies through an accessibility API. But basically, the actual ARIA attributes are not going to be added to the elements, and are just represented internally. So a CSS selector can't select them.
This was also kinda suggested by @lukewarlow in openui/open-ui#898 (comment) |
Hmm @nt1m your function selector is probably a much better idea than my pseudo element one (especially because pseudo elements don't currently work in :has()). I do feel like some way to select in css is needed though. Because it's common for playpause buttons for example to change their appearance based on state and that would currently rely on a specific Dom structure and has(). But as you say it would be quite picky with regards to invalidation. Could we potentially flip the idea (both would select the invoker button)?
Would this simplify things? |
Perhaps a more generic selector which applies when an element that is tied to another open element is expanded - effectively providing a styling hook for the implicit |
This would be confusing for the video pause/play icon use case. Since saying that a button for a video is "expanded" just because the video is playing is confusing. Also I don't think that this would work with custom invoker actions - where there's no true/false state. |
Yeah that would only be doable for the popover, dialog, details scenario |
Both of these are correct and intentional.
|
Why not reuse the pre-existing [command]:open I realise it is not the button itself that is open, but the same thing can be said about the |
Uh oh!
There was an error while loading. Please reload this page.
Looks like :popover-open is landing, but it only applies to the popover element itself.
We also need a way to style the Trigger element for the popover element when the popover element is open.
consider the following:
I would like a way to style the button when the popover is open.
This would need to apply to all elements that have the same 'popovertarget'
Ex.
It would be ideal to have something like:
Thanks
The text was updated successfully, but these errors were encountered: