Open gfellerph opened 11 months ago
My initial reaction is I think we should allow content(image/SVG is probably enough but enforcing this seems difficult?) in the thumbs (but this should be hidden from screen readers) I'm less sure on use cases for tracks.
The Open UI Community Group just discussed [switch]: Should author defined content be allowed on tracks or thumb?
.
After the Telecon, i did found another example where a switch could mean something else than on/off in a codepen. how about am/pm? (Yes, i was fishing for cookies)
@brechtDR that's really more of a radio button then that has been restyled to look like a switch (or per your example, it's a control that visually is clear, but is nonsensical in as far as how it is programmatically exposed. e.g., "AM PM, checkbox. checked (or not checked)" what the heck does a checked "am pm" control mean? AM and PM are the states someone wants instead of 'checked' or 'not checked')
i see stuff like this a lot as well, where people "want" the visual design of one type of control, but they style it to resemble a different control type - or they use the control they want in a way that distorts its intended use.
@scottaohara i agree with this. My question is rather if people won't be looking to use it for those purposes. It's a hard path in this case: design vs function. But maybe I don't really understand the big need for this and am just biased as I've been styling these things with checkboxes too much. Maybe I'm a bit "scared" that the use case and need is too specific or limited. But that is subjective and thus a personal opinion of course. I can understand other people want this in its purest on/off-but not a checkbox way.
https://twitter.com/jh3yy/status/1733296190244979015?t=f_lc95VlAVjp20jZBTXpNg&s=19
Maybe a benchmark of crazy design to see if any proposal can manage 😅
@brechtDR another example like this, from the Swiss railways (https://www.sbb.ch/) for the departure/arrival control (at least this one is a radiogroup, but looks like a switch).
@lukewarlow awesome example, I was looking for this to reference in the proposal but could not find it anymore.
I'm wondering if this would be something that could be made easier for devs by adding accessibility bindings to a switch which allows content on the track.
<label for="timetable">Show timetable for</label>
<switch id="timetable">
<track>
<trackstart><abbr title="Departure">Dep</abbr></trackstart>
<trackend><abbr title="Arrival">Arr</abbr></trackend>
</track>
</switch>
Which could read something like "Departure, selected, switch, 1 of 2". @scottaohara, would this even make sense?
This, however, would strongly contradict the idea that the switch is a binary state of a single value.
https://github.com/whatwg/html/pull/9546#issuecomment-1865357407 - The HTML proposal from Apple has an implementation to try which might be useful. Currently it supports content attribute on tracks and thumbs
There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label.
I'm working on the switch proposal pull request. @scottaohara raised multiple concerns with author defined content inside the different parts of the proposed
<switch>
element.Question
Should authors be able to add text content to either the
track
or thethumb
elements?Research
About a third of analyzed Design Systems use this feature (Design System Analysis section in the pull request).
Example: https://ant.design/components/switch
Accessibility concerns
_Relevant comment: https://github.com/openui/open-ui/pull/785#discussion_r1396420527_
Layout issues
Custom content can have various layout issues.
Live example on codepen using ant design system
Possible solutions