-
Notifications
You must be signed in to change notification settings - Fork 715
[css-ui][html] Layering concerns for 'appearance' #3526
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
Comments
What I'm worried about is that on the HTML side we'll have this thing where we branch on element (and its attributes) and decide on a render algorithm. This render algorithm might then further branch on appearance. On the CSS side we might use appearance to decide on a render algorithm for the remaining elements. That feels a little circular and depending on how you resolve it you either end up with the Chromium or Firefox behavior. I guess what you want is some kind of algorithm that takes in the element and its set of properties, and then returns what kind of thing to render. However, that means CSS ends up depending on some HTML-specific thing or we'd define the whole thing in HTML. |
We don't have to define the whole thing in HTML, we just need to define as much as we can that's consistent in CSS with some explanation of the various classes of exceptions, and then HTML can specify which elements trigger which exceptions. This isn't too different from how we define pseudo-classes. For convenience in developing the spec, I've suggested we keep the per-element details in a separate chapter of css-ui-4, then once it's stabilized we can move it over to HTML. But |
@zcorpan, @annevk Between the state of the css-ui-4 spec, and the direction the HTML spec is taking with whatwg/html#4857, I think the layering concern question is answered. Not all the pieces have fallen into place yet, but we seem to know where we're going. Are you ok with closing this issue, or am I missing something that still needs to be discussed here? |
If someone could summarize the agreed upon layering that'd help. (Or point to where that was discussed.) |
I don't think this is addressed, yet. |
Thinking about this again, I think most of the logic around 'appearance' could be in css-ui. HTML would only provide algorithms to determine whether an element, given a computed 'appearance' value, can be a specific kind of widget. Something like this, using the current state of whatwg/html#4857 css-uiThe possible kinds of widgets are none, button, searchfield, textfield, slider-horizontal, checkbox, radio, listbox, menulist, menulist-button, textarea, progress-bar, and meter. UA must run this at used value time: compute the kind of widget to use for an element element:
The appropriate widget, given a map of properties authorProps, and an expected kind of widget expected, and a fallback kind of widget fallback, is as follows:
The properties that disable native appearance for widgets are:
HTMLTo determine if an HTML element can be a button, given computedAppearance: localName is "button", or localName is "input" and inputState is one of Button, Submit, Reset, or Color. (etc, see "compute the kind of widget" in whatwg/html#4857) |
Thank you for writing that up @zcorpan! That's a very clear proposal and matches the high-level architecture outlined by @fantasai in #3526 (comment). I hope that model works for implementations. Nit: "can be a button" needs a default of some sort as otherwise it seems undefined for a number of elements. |
WRT #3526 (comment), this should be specified, but I am not convinced it be in the CSS spec. Not only should the host language own which elements can be an X, but it seems to me it should also own the list of widget types elements can be. Otherwise, HTML cannot introduce new types of widgets without first depending on an update in CSS, and that seems backwards. |
My comment above used to be in the pull request, but I moved it here since it's more a question about the general approach than about the details of the PR. Over there, @zcorpan said:
As far as I can tell, there's a generic logic which applies to most widget types, and a few are special cased. We can continue to define in the css spec what you do in those special cases, but frame the rest generically, and let HTML own the full list. Wouldn't that work? Potentially, we could even simplify further, as we don't seem to have many different types of special cases, but just two buckets: those where we care about authorProps and those where we don't. We could just define these two buckets here, and let HTML define the full list and say which widget goes in what bucket. |
OK, that seems fair enough. |
I don't think it's backwards that HTML would need CSS to be updated for widget types that require novel layout. In fact, that seems perfectly normal to me. Why would it be backwards? |
I filed #7215 against the proposal detailing which cascade origins are inspected. |
Relates to w3c#3526 This is part of an editorial rewrite of the prior work by Bocoup (@zcorpan and @howard-e): * whatwg/html#7004 * w3c#6537 Co-authored-by: fantasai <fantasai.bugs@inkedblade.net> Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Howard Edwards <howarde.edwards@gmail.com>
Alternative refactored PR posted here: #7224 |
Relates to w3c#3526 This is part of an editorial rewrite of the prior work by Bocoup (@zcorpan and @howard-e): * whatwg/html#7004 * w3c#6537 Co-authored-by: fantasai <fantasai.bugs@inkedblade.net> Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Howard Edwards <howarde.edwards@gmail.com>
Relates to w3c#3526 This is part of an editorial rewrite of the prior work by Bocoup (@zcorpan and @howard-e): * whatwg/html#7004 * w3c#6537 Co-authored-by: fantasai <fantasai.bugs@inkedblade.net> Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Howard Edwards <howarde.edwards@gmail.com>
) Relates to #3526 This is part of an editorial rewrite of the prior work by Bocoup (@zcorpan and @howard-e): * whatwg/html#7004 * #6537 Co-authored-by: fantasai <fantasai.bugs@inkedblade.net> Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Howard Edwards <howarde.edwards@gmail.com> Co-authored-by: fantasai <fantasai.bugs@inkedblade.net> Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Howard Edwards <howarde.edwards@gmail.com>
The CSS side of this has been landed, but I suppose we should keep this open until whatwg/html#7839 lands as well. |
whatwg/html#7839 was merged, closing. |
https://drafts.csswg.org/css-ui-4/#appearance-switching
The button value, if applicable to all elements, probably needs to be specified in css-ui what it does. Other values might be specified in HTML's rendering section.
There are also properties that turn off the appearance (e.g. an author-specified border on a button). In Firefox this applies to appearance values regardless of element, in Chromium this depends on the element. (Specify in HTML?)
@annevk raised in a conversation today that the layering here should be discussed. Can you elaborate here?
cc @bzbarsky @frivoal @fantasai @MatsPalmgren @tkent-google
The text was updated successfully, but these errors were encountered: