-
Notifications
You must be signed in to change notification settings - Fork 683
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
[css-ui] Unprefix 'appearance' and/or make the spec web-compatible #3024
Comments
annevk pointed me to https://groups.google.com/forum/#!msg/mozilla.dev.platform/Fq6OH5SWeRo/lxHDXFnwCQAJ |
The current spec (https://drafts.csswg.org/css-ui/#propdef-appearance) is not web-compatible at all. I'd be against unprefixing it without a proper spec for the property. cc @FremyCompany too |
Will all browsers going to support the -webkit prefixed variant, and a lot of content using that, I'm not sure there's a ton of value in unprefixing. It would certainly be great to get a spec written for this though as emilio says. I have some notes that I'm going to try and get tidied up in the near future. |
I think it would be good to have a spec that is closer to what browsers are willing to implement. I may be able to work on that in the near term. |
cc @frivoal |
Also see whatwg/compat#104 |
The version specified in css-ui-4 isn't meant to be exactly identical to the prefixed version, as the prefixed version is sort of insane. The biggest problem with the prefixed version is that there's not value that lets native form control just do their normal thing. You need a gigantic list of values, some of which are meant to apply to non-standard pseudo elements that represent parts of form controls. As far as I know, no browser is planning on harmonizing the full list of pseudos+values. The proposed "standard" version has an "auto" value to cope with that problem, so you don't need the full laundry list of values (and associated pseudos) for it to work at all. That said, we could add a few select values that people do want to opt into, either because they're genuinely useful, or for compat reasons. Browser representatives in the css wg have so far objected to doing that, but there's nothing in the design of the property that prevents us from adding more than just If we do add more, there are two ways to go about it.
The second one is much more limited, but also much easier to implement. The reason it might be useful despite the limitation is that very often, people use that value to negate an earlier The other thing that needs to be investigated in depth is exactly what The high level principle is that since this is an appearance property, not a behavior property, it should leave everything that is necessary to be able to operate the control and for which a functional equivalent cannot be otherwise recreated in pure CSS, within the limits allowed by web compat. However, going through all the form controls and figuring out exactly what that means for each of them hasn't been done. |
Anway, I think that there isn't anything specific we can do in this issue, and what we need to do is to close the related #1250, my preference being to do it by picking option 7 in comment #1250 (comment). Are y'all OK with closing this as a duplicate, and resuming the discussion there? |
I don't know, I'm much more favorable (and I think I can safely say that this goes for Mozilla as a whole) to a plan for standardizing -webkit-appearance as a start (since we all have to implement it, yay web), than adding a bunch of new functionality in a similarly named property with vastly different semantics. |
Starndardizing -webkit-appearance means explaining form controls with it in the UA stylesheet, and having the full list of values and pseudo elements to go along, since that's how it works in Blink/Webkit. The feedback I've heard in the csswg from all browsers so far was that people were not willing to do that, because it is a very leaky abstraction: the list was gigantic (and includes pseudos elements) to cover every imaginable form control and sub-component of form control, but also it needs to evolve each time we come up with a new form control, and isn't even necessarily the same on different platforms. Maybe that has changed, but then we need to realize that this cannot be limited to just specifying and/or unprefix webkit-appearance with the As far as I understand, web compat efforts around -webkit-appearance so far have not been that, and instead rely on the existence of some other unspecified mechanism (-moz-appearance) to explain the rest of the form control's appearance, that A normal css property needs to have a computed value on all elements, and the few values that have been found needed for web compat are insufficient to cover all elements. We could specify that I don't object to doing that, but specifying the shorthand without the longhand feels a little weird. That said, we could prioritize that, since it is needed for compat, and worry about that rest later. I suspect that for "the rest", there's only two alternatives though:
I don't know. In previous CSS meeting representatives from Mozilla have specifically pushed back to having any other value than |
We don't necessarily need to match webkit/chromium exactly. We can specify the intersection of what browsers do, and look at httparchive to find out what is neccessary for web compat. |
I'm not sure I understand what you propose doing. As far as I understand, both Webkit/chromium and gecko fully describe the look of all form controls using the appearance property on elements and their pseudos, using the UA stylesheet. Either we've got the full set, and we can use the property that way, or we don't we need to explain form controls differently. An appearance property that only has a subset of the value wouldn't work the same way as the webkit (or moz) prefixed one. Not just in the sense that it lacks values, but the way it works in general would have to be different. For instance, let's say we have an appearance property that only
I think we can get away with specifying the webkit prefixed one as a shorthand to something, and leave the something to later. But we'll eventually need to come back to what that is, and I suspect a property with an auto value is a much more standardizable answer than a giant list that needs to cover for every variation of every form control on every platform. |
This would be https://compat.spec.whatwg.org/#css-non-aliased - we can use that as a starting point, and define what those values mean.
https://gist.github.com/zcorpan/191f7d0183b7b41c8d44fc6fe12ac0d7 We can decide based on this data that we don't need to support the We might also decide to add "normal" as a keyword (instead of "auto"?), or take a closer look at those pages to see what they expect. etc. |
It seems to me that we're talking past each other. Specifying the intersection of values that all browsers support (or possibly the subset that are actually used in web pages), as well as the values that only chrome supports but that are needed for web compat. This is not hard. However, this does not answer the question of how the property works as a whole, and we need to answer that question if we're supposed to standardize it.
This is the approach I am pushing for, so I'm happy to go with it, but I don't see how the name of that keyword makes any difference. I'm happy to take |
Following up from the points I make above, I think the
Therefore, it has an initial value. Therefore it has a value on all elements, and isn't something like a shorthand. In the absence of author styles, the value is either Since
The UA stylesheet can use these, and the corresponding form controls will have their native look. So far so good. (note that it is neither a giant list, nor includes auto)
Ok, let's see what the restrictions are.
I believe this argues against having an
As a mechanical consequence of the previous points, implementers either have to ignore that recommendation and do the full giant list anyway, or add I don't believe that the intention of this piece of text was to make a recommendation that is impossible to follow, nor that it intended to limit the list of form controls available on the web to just 13+ε types. This means that that definition is broken. Here's what I suggest we do:
Optional steps:
|
If you suggest that Fwiw, Gecko can make individual property values available in the UA-sheet only. For example Would it be possible for other UAs to parse a different set of values for UA/author sheets? |
As an author, I have to say that Florian's argument makes the most sense, even if it means that The values that are most useful for authors are Being able to say that an arbitrary element should be styled like, e.g., a native checkbox or drop-down list, would only be useful if you could also check and uncheck that checkbox, or expand and collapse that list. But as far as I can tell, there are no properties or attributes that allow you to do that. So if you use a specific If there are specific appearance values that browsers want to make available for styling any arbitrary element, then those should be added. But if a specific value only makes sense on a specific element or pseudo-element, then I don't understand what the web-compat risk is in mapping that value to |
Isn't the "do whatever you'd normally do for this element" use case already solved by |
https://www.chromestatus.com/metrics/feature/popularity has use counters for different values (search for "CSSValueAppearance"). I don't know yet how to interpret these; it seems CSSValueAppearanceButton is much higher than CSSValueAppearanceButtonForButton. Also see https://bugs.chromium.org/p/chromium/issues/detail?id=767757 |
@zcorpan I'd guess that the |
But CSSValueAppearanceButtonForAnchor doesn't add up to the general counter. |
@zcorpan That's a good point. Sites could be doing what Facebook is doing though: |
The data means that |
That 0.01% is 102 pages in HTTP Archive.
-> |
I have updated https://developer.mozilla.org/en-US/docs/Web/CSS/appearance so that it has complete (I believe) information for Firefox, Chrome, Safari, and Edge. I created the following spreadsheet to flesh out a proposal that covers enough for web compat, but also restricts what the values can apply to. https://docs.google.com/spreadsheets/d/1YdMpU172CP60QUoomzK2iJpZw7kHQi9X2PjPUoNu20s/edit?usp=sharing |
Also, have we decided whether we want to keep I’m asking because |
Yes,
|
I added more counters to Google Chrome, and here is the current summary: Summary:
Data: (Following counter values are page view ratio in which an element with the keyword is painted. 'for others' means the keyword is applied to elements which doesn't have the keyword in UA stylesheet.) A) Usage is not low. B) Usage is low. Changing their behavior would have some risks. However probably it's doable. C) Usage is very low. However they are necessary for vertical input[type=range] in WebKit and Blink. See whatwg/html#4177 D) Usage is very low. |
Thank you, @tkent-google !
For For How do we find out where this is needed? Can we try making it an alias to
|
OK I have now looked for 506 pages have Of these, 505 use a selector with The last 1 was
...which seems to be a misspelling of "webkit-search-cancel-button" So this value does not need to apply to anything apart from the pseudo-element. Furthermore, since |
What about
|
I wrote:
I almost forgot about this: #3574 In particular, it has an effect (different from |
I thought we could drop support of category B for simplicity. However
Oh, I found " I have no idea of usecases of " Probably Chrome's action items would be:
|
Based on the information above, these are the edits I suggest for the spec:
|
Per web compat analysis [1], the `button` value can be restricted to * `a` * `button` * `input type=button/reset/submit` * drop-down box `select` Part of w3c#3024 Tests: TODO [1] w3c#3024 (comment)
Tests: already covered by css/css-ui/appearance-cssom-001.html Part of w3c#3024.
Pseudo-elements for internal parts of controls (e.g., `::-webkit-search-cancel-button`) and related 'appearance' values (e.g., `searchfield-cancel-button`) must not be exposed to author origin CSS or in `getComputedStyle()`. If user agents find that they can't remove support for something, the pseudo-element and the appearance value should both be specified. Tests: - 'appearance' values: already covered by css/css-ui/appearance-cssom-001.html - pseudo-elements: TODO - getComputedStyle: TODO Part of w3c#3024.
CSS Cascading and Inheritance defines the term "legacy name alias" as follows:
I can't tell if |
The novelty discussed in that comment is about supporting some keywords in the UA stylesheet but not in author stylesheets. I think that's orthogonal to aliasing. "Legacy name alias" as defined should be OK I think. |
@zcorpan I think this issue has served its purpose, and can now be closed. There are/will be more issues about |
Actually, we have a resolution to close, in #3024 (comment). Closing accordingly. Please reopen new, more specific issues, if anything is left to do that isn't covered in other open issues. |
Sounds good. Thank you @frivoal |
In whatwg/html#3912 there is a proposal to specify two new values of the 'appearance' for the fieldset and legend elements.
I note that none of WebKit, Chromium, Gecko or Edge support 'appearance' unprefixed, but they do support 'webkit-appearance'.
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6114
Would it be reasonable to unprefix it?
cc @mstensho @MatsPalmgren @dholbert @emilio @thejohnjansen @smfr
The text was updated successfully, but these errors were encountered: