-
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
Define :blank pseudo-class behavior #8451
Comments
@annevk Good thoughts! As far as I can tell from the current spec (MDN | spec), this is intended to only work on form elements. You pose some really important questions re how this works for "non-text-inputable" fields. I didn't have any role in the spec writing, so I'd like to invite the current editors of selectors-4, @tabatkins and @fantasai, to join this conversation as their opinions hold exceedingly more weight than my own. I've broken this up into an itemized list below, but the gist imo is that
Naturally, this will exclude certain field types and other form-related elements. For example, There are also a few special cases I think it might help to provide custom functionality for, those being These would be my expectations/guesses as to the function of represented as a table
represented as a list
|
@brandonmcconnell thanks for the great enumeration of the controls and specific proposal. I agree with most of what you've proposed. My questions would be:
Date controls on at least some platforms can be partially filled out. E.g. In that case,
Select controls don't really have the concept of "empty", do they? I.e. even a select menu without any
This feels problematic. What if the
I must admit I've never quite wrapped my head around |
As @smaug---- notes in the originating issue we also need to deal with |
|
cc @zcorpan @whatwg/forms |
I think I also agree - a control that is showing a placeholder seems like it should be considered "
Right, yes. I shouldn't have included this line in my comment:
I agree that |
Yep! Just to clarify, I think
I can see how my loose use of the word "empty" could easily cause confusion with |
@mfreed7 I agree. Good thoughts across the board. Responding to each—
— |
I don't know what _base means, but why wouldn't select size > 1 match :blank? |
@smaug---- Could you clarify what you mean by "select size > 1"? |
@smaug---- means this case: |
@annevk @smaug---- Ahh well TIL 😆 I had no idea that attribute even existed and that it worked like that. Yes, that should probably be supported as well, when size > 1 Thanks for calling that out, @smaug---- 🙌🏼 So re
— |
/cc @tabatkins @fantasai as editors of Selectors, to see if the proposal inside the |
Not speaking for the CSS Working Group, but @tabatkins and I more or less agree with the outline in #8451 (comment) with a few extra comments:
The rule of thumb is, “if it always submits, and would do so with an empty string, it's |
@fantasai Really good thoughts all around. Those are great clarifications, and I'd love to move the For the time being, I'll go ahead and make those adjustments to my outline above. If we're going to enable |
|
Good point! Okay that removes my own weak "technically redundant" objection. |
I adjusted my outline above to match that change as well. |
I would definitely expect |
Yeah, good point. I would definitely vote for That way, anyone who needs to target a hybrid between the two can do so like this: *:blank:not(:placeholder-shown) {
/* ... */
} |
Yes, an element showing a placeholder should still be blank (basically by definition; we show placeholders when the input is blank!). |
The discussion here seems pretty conclusive, but there are still some unanswered questions in this related CSSWG thread, if some of you wouldn't mind chiming in there as well: w3c/csswg-drafts#1967 |
Through web-platform-tests/interop#179 I learned about the
:blank
pseudo-class. It would be good if we defined how it works for HTML elements.cc @whatwg/css
The text was updated successfully, but these errors were encountered: