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

Should open dialog elements match :open? #8625

Open
josepharhar opened this issue Dec 15, 2022 · 9 comments
Open

Should open dialog elements match :open? #8625

josepharhar opened this issue Dec 15, 2022 · 9 comments
Labels

Comments

@josepharhar
Copy link
Contributor

This was brought up here: #8221 (comment)

The new popover attribute adds the :open pseudo-selector which matches elements with the popover attribute when they are open and are in the top layer. It would make sense for dialog elements to also match this pseudo selector when they are open.

@mfreed7 @annevk

@annevk
Copy link
Member

annevk commented Dec 15, 2022

cc @whatwg/css

@annevk annevk added the topic: dialog The <dialog> element label Dec 15, 2022
@tabatkins
Copy link
Contributor

No strong opinion, but yeah, seems like it's an appropriate match for the pseudo, and authors would probably expect it. It's certainly "an element that has both open and closed states".

(And remember we have the :closed complementary pseudo-class!)

@tabatkins
Copy link
Contributor

tabatkins commented Dec 15, 2022

Oh, by "no strong opinion" I apparently mean "yes, I wrote that details was an exemplar element for the pseudo-class in the spec".

So yeah, please define details as matching :open/:closed. ^_^

@nt1m
Copy link
Member

nt1m commented Dec 16, 2022

I think it's a good idea, given the open attribute doesn't necessarily reflect the state (for dialog specifically). We should probably also change the default UA styles too.

@domenic
Copy link
Member

domenic commented Dec 16, 2022

given the open attribute doesn't necessarily reflect the state (for dialog specifically)

I still think we could fix this. Someone just needs to sign up to drive #5802 to completion. (I don't think I have the bandwidth to be that person, unfortunately.) #5802 (comment) is a fairly concrete proposal, although were was some followup that might be worth resolving.

@mbrodesser-Igalia
Copy link
Member

@josepharhar: given #9077, this can be closed?

@josepharhar
Copy link
Contributor Author

@josepharhar: given #9077, this can be closed?

No, that PR is for the popover attribute, not dialog elements.
Dialog elements should still match :open and :closed as they are specified in CSS

@josepharhar
Copy link
Contributor Author

So the pseudo-class for popover was renamed to :popover-open in order to differentiate it from :open since any element can be a popover and be open as a popover separately from a dialog, details, or select element being open.

We can and should still make :open and :closed apply to dialogs, details, and selects as tab mentioned is written in the selectors spec.

@annevk
Copy link
Member

annevk commented Sep 18, 2023

Well, someone would first have to define that mapping in HTML's Pseudo-classes section. The Selectors specification gives host-agnostic guidance so we still need to define exactly when non-generic things defined therein match.

cc @tabatkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

6 participants