Re: [csswg-drafts] [css-pseudo] ::indicator proposal for radio & checkbox controls (#5914)

The CSS Working Group just discussed `::indicator pseudo-element`.

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> Topic: ::indicator pseudo-element<br>
&lt;TabAtkins> github: https://github.com/w3c/csswg-drafts/issues/5914<br>
&lt;TabAtkins> gregwhitworth: Proposal for an ::indicator pseudo<br>
&lt;TabAtkins> gregwhitworth: Problem is appearance of checkbox and radio controls vary greatly across browsers<br>
&lt;TabAtkins> [shows slide of different browser checkboxes]<br>
&lt;TabAtkins> gregwhitworth: Investigating a bunch of components, but checkbox/radio is #2 most cited problem<br>
&lt;TabAtkins> gregwhitworth: OpenUI is already working on the more general problem [describes general checkbox internal structure]<br>
&lt;TabAtkins> gregwhitworth: So right now I'm just talkinga bout the indicator itself<br>
&lt;TabAtkins> gregwhitworth: Proposal is ::indicator pseudo on input[type=checkbox] and [radio], selecting the check/dot in the element.<br>
&lt;TabAtkins> gregwhitworth: There are probably more indicators, like in range inputs, but not getting to those now, they're more complex.<br>
&lt;TabAtkins> gregwhitworth: We saw from accent-color that often the functionality and visuals of a radio/checkbox are fine, they just want to change colors. We don't necessarily want people to ahve to rebuild from the ground up, like appearance:none requires<br>
&lt;TabAtkins> gregwhitworth: So interop becomes the questions<br>
&lt;TabAtkins> gregwhitworth: We've got a lot of variation cross-brwoser currently, how do we let authors have meaningful customization<br>
&lt;TabAtkins> gregwhitworth: I propose there is a "base" keyword for 'appearance', specifying that the widget must render with a standard-defined way.<br>
&lt;TabAtkins> [slide shows a standardized checkbox]<br>
&lt;fantasai> Better idea: use the checkmark Unicode character<br>
&lt;TabAtkins> gregwhitworth: So there would literally be an &lt;svg>&lt;path>&lt;/svg> to render the checkbox, and can thus style with SVG properties<br>
&lt;florian> q+<br>
&lt;TabAtkins> gregwhitworth: So people asked why we needed to go to this level of detail<br>
&lt;TabAtkins> gregwhitworth: You don't know what's between the component root and the checkmark<br>
&lt;TabAtkins> gregwhitworth: Earlier with password-reveal, our internal structure was actually really complicated, with some funny details that limited authors<br>
&lt;TabAtkins> gregwhitworth: So learning from that, we wanted to give authors well-defined DOM/styles that they can work off of<br>
&lt;TabAtkins> gregwhitworth: But make it opt-in so everything stays with the native look-and-feel by default<br>
&lt;TabAtkins> gregwhitworth: I've built a web component that follows this model, and was able to do a ton of variations [shows off many variations from the same SVG base]<br>
&lt;TabAtkins> gregwhitworth: Other possibilities we discarded:<br>
&lt;TabAtkins> gregwhitworth: using background-image on ::indicator rather than inline SVG<br>
&lt;TabAtkins> gregwhitworth: using a unicode character inside ::Indicator<br>
&lt;TabAtkins> gregwhitworth: Both of these, you just don't get the same flexibility<br>
&lt;TabAtkins> gregwhitworth: And the interop of unicode characters happens to be very good, but bc it's text you're very limited in what you can control about it<br>
&lt;TabAtkins> gregwhitworth: So open questions<br>
&lt;leaverou> (Also it's trivial to generate an SVG with a single &lt;text> that contains a unicode character)<br>
&lt;TabAtkins> gregwhitworth: What happens if you want to change the graphic entirely?<br>
&lt;TabAtkins> [shows off an inverse path on a shield]<br>
&lt;leaverou> Question: What would ::indicator { content: "✔️"; } do?<br>
&lt;TabAtkins> gregwhitworth: Tangential to this, being able to adjust viewBox via CSS would b euseful for this<br>
&lt;TabAtkins> gregwhitworth: So while this gets us 80% there, there are much more ocmplex scenarios<br>
&lt;TabAtkins> gregwhitworth: [shows off animation flipping from check to x]<br>
&lt;TabAtkins> gregwhitworth: OpenUI's more freeform solution gives you fuller control if you need it<br>
&lt;TabAtkins> gregwhitworth: So proposal is we add "appearance:base", and add ::indicator for checkbox/radio to select the check/dot.<br>
&lt;emilio> q+<br>
&lt;florian> q?<br>
&lt;TabAtkins> TabAtkins: Does ::indicator select the &lt;svg> or the &lt;path?<br>
&lt;TabAtkins> gregwhitworth: &lt;svg>, so you can control the box<br>
&lt;TabAtkins> TabAtkins: Okay so we'll need structure there so you can apply 'd', since it doesn't inherit<br>
&lt;TabAtkins> gregwhitworth: Yeah, another pseudo, or [...]<br>
&lt;TabAtkins> leaverou: Woudl 'content' property work?<br>
&lt;TabAtkins> gregwhitworth: Haven't considered it, would need to think about it.<br>
&lt;fantasai> +1 leaverou , exactly what I was going to say<br>
&lt;TabAtkins> leaverou: I'd expect 'content' to work, as an author, the same way it works for list markers.<br>
&lt;TabAtkins> gregwhitworth: So you'd expect it to cancel out the built-in SVG?<br>
&lt;TabAtkins> leaverou: Yes<br>
&lt;TabAtkins> fantasai: One of the things on my q would be to say the same thing as Lea.<br>
&lt;Rossen_> q<br>
&lt;TabAtkins> fantasai: I'd say it should be just a pseudo with 'content' that the UA sets to an SVG<br>
&lt;TabAtkins> TabAtkins: If you rely solely on that, the only way to plumb in an SVG is via an iamge, and it's not stylable<br>
&lt;tantek> IMO a Unicode checkbox character wouldn't match anything that anyone implements, so that seems like a bad idea<br>
&lt;TabAtkins> fantasai: So we could default to text, but the author could then style in more things.<br>
&lt;TabAtkins> fantasai: It would be easy to adjust that.<br>
&lt;TabAtkins> gregwhitworth: Only stuff you could do with text<br>
&lt;nicole> +1 for having multiple ways of creating the glyph e.g. svg, font, image (but it wouldn't be a background image)<br>
&lt;tantek> we really shouldn't define things with defaults that are ugly<br>
&lt;fantasai> TabAtkins: Still can style using content easily, even if we use default is an SVG<br>
&lt;fantasai> TabAtkins: and can do a lot more if the default content is a standardized SVG<br>
&lt;TabAtkins> leaverou: And you don't need graphics software, can just write a data URL<br>
&lt;TabAtkins> gregwhitworth: and how do you get that checkmark image put together?<br>
&lt;tantek> agreed with gregwhitworth, don't make authors completely have to redefine a checkbox in order to tweak its styling<br>
&lt;TabAtkins> gregwhitworth: Without reaching for graphics software, can't adjust padding or sizing, can't add drop shadows, etc<br>
&lt;TabAtkins> leaverou: I thought with "appearance:base" you could just set all those properties<br>
&lt;TabAtkins> gregwhitworth: You can, but SVG still offers more power in graphical means<br>
&lt;jensimmons> q+<br>
&lt;TabAtkins> gregwhitworth: And I'm also trying to set up the convo for the range pseudo in the next convo, and they'll ahve more complex needs that wouldn't be handleable via text<br>
&lt;nicole> q+<br>
&lt;leaverou> q+<br>
&lt;TabAtkins> fantasai: wrt appearance:base, you were hinting in October, glad to see this<br>
&lt;tantek> No browsers's current checkboxes look like Unicode checkbox characters, seems like a hack to try to shoehorn like that or to explore that<br>
&lt;TabAtkins> fantasai: agree with premise. concern with doing it *right now* is that before we ship it, we'll need a structure for every html element<br>
&lt;astearns> ack fantasai<br>
&lt;TabAtkins> fantasai: If we ship for checkbox/radio and haven't figured out the other inputs, we'll have compat problems when we alter try to ship it for other inputs<br>
&lt;leaverou> +1 to what fantasai just said<br>
&lt;TabAtkins> gregwhitworth: what compat problems?<br>
&lt;tantek> +1 to what fantasai said, e.g. range control<br>
&lt;dholbert> (in particular if someone styles using `input {...}` as their selector, I imagine)<br>
&lt;TabAtkins> fantasai: If there's an effect on checkbox, but not *currently* on selects/files/etc, then people will apply the property too widely and it'll just do nothing so they won't notice; later when we define effects it'll change the page<br>
&lt;TabAtkins> gregwhitworth: It'll take a very long time to get all those structures in place...<br>
&lt;fantasai> TabAtkins: You're missing fantasa's point. Right now, it doesn't do anything on file input, people will apply it to all inputs to get the effect they want<br>
&lt;tantek> +1 good summary TabAtkins<br>
&lt;fantasai> TabAtkins: and then if you make it have an effect later, then that'll break pages<br>
&lt;astearns> q?<br>
&lt;fantasai> gregwhitworth: I would like to figure out how to do that in less than 10 years<br>
&lt;fantasai> TabAtkins: You could have different keywords per input type<br>
&lt;fantasai> TabAtkins: e.g. base-checkbox<br>
&lt;fantasai> TabAtkins: A little more awkward to use...<br>
&lt;fantasai> gregwhitworth: but maybe 10yrs later we can have just 'base'<br>
&lt;TabAtkins> fantasai: Another thing: naming it ::checked-indicator would make it clearer, ::indicator is super generic<br>
&lt;leaverou> Or just embrace the generic-ness and call it ::marker :))<br>
&lt;TabAtkins> gregwhitworth: I purposely didn't do the openui agenda for naming; we resolved on "indicator" there bc it's the generic word across component libraries<br>
&lt;tantek> +1 fantasai agreed, "indicator" sounds too generic, unless we actually define what it means for all controls that have "indicators", e.g. the disclosure triangle from summary/details!<br>
&lt;TabAtkins> fantasai: Sure, no problem with "indicator" itself, just that *by itself* it's not clear what it refers to<br>
&lt;TabAtkins> fantasai: Another topic: 'content' should apply so we can swap out for text or other images<br>
&lt;TabAtkins> fantasai: If you want the default contents to be a particular SVG, sure; but 'content' should still apply<br>
&lt;TabAtkins> gregwhitworth: Oh yeah sure, please open an issue for this<br>
&lt;TabAtkins> gregwhitworth: I like the idea of not having `[type=checkbox]::checkmark-indicator`<br>
&lt;leaverou> -1 to ::checked-indicator, as greg pointed out it would end up being too generic<br>
&lt;fantasai> ::checked<br>
&lt;fantasai> ::checked-indicator<br>
&lt;brandon> wouldn't ::indicator be targeted by the elements state? e.g. checked, indeterminate? which then makes its specific?<br>
&lt;leaverou> s/too generic/too repetitive/<br>
&lt;TabAtkins> fantasai: ::checked-indicator to match :checked<br>
&lt;TabAtkins> gregwhitworth: You'll be applying this alongside selector that already targets the element, so it should be obvious from the fuller selector context that this is a checkbox indicator<br>
&lt;Rossen_> q?<br>
&lt;TabAtkins> florian: I'm unsure how this - i like appearnce:base<br>
&lt;Rossen_> ack florian<br>
&lt;TabAtkins> florian: Unsur ehow styling works in UA stylesheet<br>
&lt;emilio> hah, was going to mention just this<br>
&lt;TabAtkins> florian: Can't select off of the property value<br>
&lt;TabAtkins> florian: But the UA probably does want to style appropriately based on the base value<br>
&lt;tantek> semi-agreed with florian, please don't overload 'appearance'<br>
&lt;TabAtkins> florian: So probably want some magic in the UA stylesheet for this<br>
&lt;Rossen_> q?<br>
&lt;emilio> actually, on checkboxes border doesn't suppress appearance<br>
&lt;TabAtkins> gregwhitworth: Yeah wehn I discussed with TabAtkins earlier we realized that magic would be necessary.<br>
&lt;tantek> q?<br>
&lt;fantasai> TabAtkins: It's a UA stylesheet in the shadow<br>
&lt;fantasai> florian: It's not just the parts inside that you're styling, but the checkbox element itself<br>
&lt;fantasai> fantasai: You can select the host element from shadow<br>
&lt;TabAtkins> florian: For existing checkbox/radio button, wonder if we could get away with ::before in that magic stylesheet<br>
&lt;TabAtkins> florian: I think if we were defaulting to unicode for checkbox, we could use ::before; if you want to default to an SVG that wouldn't fly...<br>
&lt;TabAtkins> florian: Anothe rpoint<br>
&lt;gregwhitworth> btw, here's a non-production web component that shows this: https://codepen.io/gregwhitworth/project/editor/754e0097edc1dd2e17617a36fed89d06<br>
&lt;TabAtkins> florian: For the controls that are reasonably stylable with appearance:none, people have styled them<br>
&lt;TabAtkins> florian: For the ones that are complex enough that "none" is unusable bc too much structure is needed, maybe we could define that "none" is the same as "base". Like for range controls<br>
&lt;TabAtkins> gregwhitworth: Yeah I was going to piggyback on "none" ages ago<br>
&lt;TabAtkins> florian: Also, +1 to tab's idea of specialized keywords<br>
&lt;Rossen_> ack emilio<br>
&lt;TabAtkins> emilio: Was gonna mention some of Florian's point, namely tweaking UA stylesheet is annoying<br>
&lt;TabAtkins> emilio: Right now, checkbox and radios are trickier than most, because appearance:none changes the box itself - it'll start respecting the display value, for example<br>
&lt;TabAtkins> emilio: For most controls we can explain it as shadow DOM<br>
&lt;TabAtkins> emilio: So Gecko has the ability to create elements at layout time; webkit/blink can't do that, they have the shadow present immediately and change the styling<br>
&lt;faceless2> present-<br>
&lt;TabAtkins> emilio: So it would be tricky, but overall this seems sane<br>
&lt;TabAtkins> emilio: Also right now, no browser creates a bunch of elements for checkboxes/radios, so if you have thousands that gain "base" it could slow things down<br>
&lt;TabAtkins> emilio: Right now they're just a single elemnt with a paint-time rendering<br>
&lt;TabAtkins> emilio: The shadow dom-in-stylesheet thing only works if the shadow dom is not there with appearance:auto<br>
&lt;TabAtkins> emilio: I think gecko can do it, but other browsers maybe not. IMplementability is tricky.<br>
&lt;TabAtkins> emilio: Borders in particular don't have florian's issue - nothing suppresses auto appearance for checkboxes<br>
&lt;astearns> ack jensimmons<br>
&lt;TabAtkins> jensimmons: I don't feel comfortable resolving on this yet<br>
&lt;Rossen_> ack jensimmons<br>
&lt;TabAtkins> jensimmons: I'm not sure what's actually bieng proposed yet - there was no code examples in the slides, ther'es no explainer...<br>
&lt;TabAtkins> jensimmons: Not even deatils needed, just big-picture of what are we doing, what's the plan for the future...<br>
&lt;fantasai> gregwhitworth, just send an attachment to www-archive@w3.org<br>
&lt;TabAtkins> gregwhitworth: I think those are all answere din the explainer, which I just can't expose publicly quite yet<br>
&lt;TabAtkins> Rossen_: Very valid feedback - getting the explainer out ahead of the discussion would have answered these questions<br>
&lt;TabAtkins> gregwhitworth: So inverting, would someone be against me writing a PR as we reveal the explainer, etc?<br>
&lt;TabAtkins> Rossen_: There's a lot more details than just PR - you'll go thru a TAG review, etc. It'll speed up once you get an explainer out.<br>
&lt;tantek> +1 to a much more clear / expanded explainer, rather than spec text<br>
&lt;Rossen_> ack nicole<br>
&lt;TabAtkins> nicole: I think this is a problem worth solving.<br>
&lt;TabAtkins> nicole: We did some looking around how appearance:none is currently used<br>
&lt;TabAtkins> nicole: We foudn another compat problem - people applied props that *only* work when appearance:none is on, but don't set appearance:none so those props dont' do anything<br>
&lt;TabAtkins> nicole: So they get backwards non-compat accidentally<br>
&lt;tantek> +1 nicole, use of appearance is confusing already, and I'd take that a step further: OpenUI should (must?) not use 'appearance' for any aspect of its design<br>
&lt;TabAtkins> Rossen_: Are youa skign about a fallback mechanism?<br>
&lt;TabAtkins> nicole: No, this feature triggers many things working, but if people use this now without (accidentally) turning this on, it makes things hard to change in the future<br>
&lt;TabAtkins> nicole: So if they set, say, height on it, which only works with appearnce:none, then that makes it hard for us to ever make 'height' work on default appearance for those elements<br>
&lt;gregwhitworth> Explainer: https://github.com/salesforce/standards-explainers/blob/master/indicator-psuedo/explainer.md<br>
&lt;TabAtkins> fantasai: But that doesn't happen unless you set appearance<br>
&lt;gregwhitworth> yay, it went public just in time :)<br>
&lt;Rossen_> q<br>
&lt;Rossen_> ack leaverou<br>
&lt;TabAtkins> nicole: Right, this was building on the earlier talk about this making it hard to ship "base" for othe relements in the future<br>
&lt;TabAtkins> leaverou: ABout where :indicator points<br>
&lt;TabAtkins> leaverou: If it points to the SVG, you can set storke/fill on the svg and those inherit<br>
&lt;TabAtkins> leaverou: Anothe rpoint, not sure about base-checkbox/base-radio, seems ocnfusing that you can apply them to othe rprops and they don't work<br>
&lt;TabAtkins> gregwhitworth: I already proposed that ::indicator is on the SVG<br>
&lt;TabAtkins> leaverou: Oh, ok<br>
&lt;tantek> +1 leaverou yes 'appearance' is a complete mess (again, I'm sorry). please stop attempting to expand it.<br>
&lt;Rossen_> ack fantasai<br>
&lt;TabAtkins> leaverou: Woudl also be good to have slides posted<br>
&lt;tantek> (I'm not queuing because leaverou already made the points I wanted to make)<br>
&lt;Rossen_> ack tantek<br>
&lt;Rossen_> ack TabAtkins<br>
&lt;fantasai> TabAtkins: need to point to path as well, because some properties don't inherit, like the path<br>
&lt;fantasai> TabAtkins: Most things can go onto svg, no problem<br>
&lt;fantasai> TabAtkins: Wrt base-checkbox etc. Reason those were weird and bad for appearance is because they were defined as "make this element look like this other thing" on any element<br>
&lt;fantasai> TabAtkins: They were supposed to do something, didn't, and wasn't clear what they were supposed to do at all<br>
&lt;gregwhitworth> https://www.irccloud.com/pastebin/S1etVZTK/<br>
&lt;gregwhitworth> jensimmons: ^<br>
&lt;fantasai> TabAtkins: The new values would only work on the matching elements, and would be well-defined what it does<br>
&lt;florian> q+<br>
&lt;fantasai> TabAtkins: doesn't have any effect on other things, will be interoperable<br>
&lt;fantasai> TabAtkins: doesn't have same problems as the previous appearance values<br>
&lt;fantasai> leaverou: Wrt SVG path, can just replace the SVG<br>
&lt;fantasai> TabAtkins: Then can't style it<br>
&lt;TabAtkins> florian: Also: the appearnace list had all the control *parts*, which made the property's list enormous, and different brwosers had different anatomies so their lists were different...<br>
&lt;Rossen_> ack florian<br>
&lt;TabAtkins> florian: Not trying to reproduce that, so this would be more manageable.<br>
&lt;TabAtkins> Rossen_: So wrapping up, Greg has dropped an explainer link.<br>
&lt;tantek> (aside: correction: appearance didn't have the control *parts* but rather had a hierarchy of types of controls, I can see how that could be confusing though)<br>
&lt;TabAtkins> Rossen_: It feels like people in the group want to be able to read the explainer before resolving on anything. Can you bring it back next week's call after people have a chance to read?<br>
&lt;TabAtkins> gregwhitworth: Yes, and please file issues as you find things.<br>
&lt;TabAtkins> &lt;br dur=10min><br>
&lt;TabAtkins> emilio, it would still work to have the SVG always inside the checkbox but display:none'd by default, right?<br>
&lt;TabAtkins> it woudl increase the weight of the elements, which you reaised as a separate concern<br>
&lt;tantek> FYI: original 'appearance' definition in case anyone wants the sordid history: https://www.w3.org/TR/2002/WD-css3-ui-20020802/#appearance<br>
&lt;TabAtkins> tantek: If you consider 'appearance' poisoned, nothing particularly wrong with minting a new property here, it's just that 'appearance' *already* has the right semantics.<br>
&lt;emilio> TabAtkins: hmmm, you mean with `appearance: none`? Having something like a shadow dom with the hidden svg could work I suspect, yeah<br>
&lt;TabAtkins> emilio: Dunno quite what you mean wrt appearance:none here, but probably, yes.<br>
&lt;emilio> TabAtkins: yeah, I meant that it wouldn't affect current uses of appearance: none<br>
&lt;TabAtkins> emilio: Then yes, definitely.<br>
&lt;TabAtkins> Also: I'm out for the day so kitty can go to the vet. See y'all Thursday!<br>
&lt;myles> ScribeNick: myles<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5914#issuecomment-776104777 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 9 February 2021 17:25:35 UTC