-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Is it ok for popover to claim general names like :open and :closed? #9055
Comments
It seems like this issue has been noticed when it comes to the script APIs, which are named
|
From https://drafts.csswg.org/selectors/#open-state
From https://html.spec.whatwg.org/multipage/semantics-other.html#selector-open
So there's disagreement here between the specs. The CSS spec thinks it should apply to other elements, the HTML spec thinks otherwise (and seems against the resolution - thanks @bkardell for the heads-up). The issue is, we'll quickly end up with code written assuming that But let's say we do things the CSS spec way. What does |
relates to #8625 |
Also #8884 |
I kind of like |
I don't think there is disagreement with the CSS WG. It just hasn't been implemented for all features as-of-yet as the issues above show. Popovers happened to be first. |
There's no concern around |
I don't know. Is it likely web developers would run into it? Or are you concerned about generic code not being able to distinguish? |
Dialog can't be I could see the confusion if we expand the definition to things like |
Though it's unlikely that web developers are going to use expandable widgets like |
Hah, yeah, I meant to type I guess I'm a little nervous about "it probably won't happen much" being the reasoning, when we should just prevent it being a problem. |
Pseudo-classes kinda have this generic nature to them though. E.g., |
I think the difference here is that there's overlap with the various definitions of open. With Whereas:
This gets even trickier when you consider
If we take that as written, then it means The definition could be changed to: The …which avoids the both-states-at-once problem, but it also means |
@jakearchibald note that @whatwg/css should probably weigh in here. |
I believe clear language is important. So i'm still in favour of simple terms such as open and closed. The most basic reason: easier to learn and understand. Especially if there would be a prefix for everything in the future, i believe that it would become too confusing, consistency is key. But I won't downplay the concerns here as there are some really interesting cases here. |
I don't think number of characters is a fair measure of simplicity. The term may be simple, but the behaviour isn't.
Consistent with what? This kinda reminds me of the Monty Python sketch, abridged somewhat:
…where everyone having the same name is confusing, but it's done in the name of consistency. Calling many different behaviours "open" and "closed" isn't making things simpler, it's making things more complicated, especially in cases where a single element can use different definitions of "open" and "closed", and use multiple of those at the same time. |
Summary for the call: Right now,
Although, it seems like there might be appetite to expand this to other elements later #8884. And that seems to match the original intent and resolution. From https://drafts.csswg.org/selectors/#open-state:
There's some risk to doing this later, as code in the wild like But even if that change can be made, it seems bad to have overlap with the various definitions of open. With say, Whereas:
This gets even trickier when you consider
If we take that as written, then it means The definition could be changed to: The …which avoids the both-states-at-once problem, but it also means I think this would be much clearer if the overlap was avoided. If we want pseudo-classes for open popovers (I guess there's a question if we need them at all), we could have a pseudo-class targeting that specifically, such as |
Would the problem go away if we prevent |
Do you mean it can be open as non-modal and open as modal? Since |
It solves the overlap on those elements. We'd also need to prevent popover applying to anything else that could be open/closed in future. That would probably prevent any other attribute adding open/closed behaviour too (in the way
Dialogs can be open non-modal, open modal, open as a popover, or none of those. The |
Ah, I misunderstood and thought
|
I somehow agree, but just saying we shouldn't rush to conclusions.
So yes, personally, i'm not a fan of the prefixed idea. -> What i ment with consistency. @zcorpan seems to be the interesting way to go about this instead of longer/prefixed names. |
Open UI resolution: Talk to CSSWG about specific pseudo-class instead of Minutes: https://www.w3.org/2023/03/23-openui-minutes.html#t05 |
I opened a CSSWG issue to discuss: w3c/csswg-drafts#8637 |
I think this was fixed by #9077; please let me know and/or reopen if I'm wrong. |
https://html.spec.whatwg.org/multipage/semantics-other.html#pseudo-classes:popover-showing-state
Right now, popovers get a pseudo-class of
:open
when they're open, and:closed
when they're closed.These seem like really general names. Does it make sense for popover to own them?
Without understanding this is purely a popover feature, it seems weird that
el.matches(':open')
doesn't apply to open<details>
,<dialog>
,<select>
, etc etc.The text was updated successfully, but these errors were encountered: