Fix placeholder label option to allow wrapper elements - #12893
Conversation
This changes the check for an ancestor optgroup instead. Fixes whatwg#12892.
annevk
left a comment
There was a problem hiding this comment.
I'm surprised we don't say anything about the option element being disabled here.
Also, even if we fix this, I wonder if we need another issue to address this for appearance base:
If a select element contains a placeholder label option, the user agent is expected to render that option in a manner that conveys that it is a label, rather than a valid option of the control. This can include preventing the placeholder label option from being explicitly selected by the user. When the placeholder label option's selectedness is true, the control is expected to be displayed in a fashion that indicates that no valid option is currently selected.
|
Why did you omit the template? It seems like this should come with tests and possibly browser bugs? |
|
Added template back in; @annevk do you have a webkit bug or shall I file one? |
|
This PR resolves one point in #12855 👍. |
Currently, it's up to authors how the placeholder option behaves, usually the I interpret the rendering paragraph as describing behavior that could be represented by the following example CSS:
select option:placeholder {
color: color-mix(currentColor 60%, transparent);
}
(It's a bit sus to do this by default; I'm not aware of any UAs that do it.) select option:placeholder {
display: none;
}
select:invalid::field-content,
select:invalid > button:first-child {
color: color-mix(currentColor 60%, transparent);
}
:user-invalid {
border-color: red;
} |
This changes the check for an ancestor optgroup instead.
Fixes #12892.
(See WHATWG Working Mode: Changes for more details.)