[switch] Differentiate the semantics of a switch vs a checkbox
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 4.5k
- Forks
- 226
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 4
Description
The draft switch explainer in #785 says "A switch toggles a binary state on or off." In HTML, a checkbox is defined as
The input element represents a two-state control that represents the element's checkedness state. If the element's checkedness state is true, the control represents a positive selection, and if it is false, a negative selection.
The HTML proposal for switch says
The input element, when the switch attribute is set, represents a two-state control representing the element's checkedness. If the element's checkedness state is true, the control represents a positive selection, and if it is false, a negative selection.
This makes it seem like a switch is just an alternate style for a checkbox, and since we try to put style in CSS and semantics in markup, maybe the switch UI should just be appearance: switch on a checkbox input. (And maybe that appearance wouldn't apply to a checkbox with the indeterminate attribute, to avoid needing to answer the question of how to map that to native switch controls.)
But there probably is some reason beyond styling that people use switches instead of checkboxes. It's not that they have an immediate effect: checkboxes can also have an immediate effect. Whatever the reason is, the explainer here and the eventual spec should explain it so that authors can know which to use.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the draft switch explainer in issue #785 alongside the linked HTML checkbox definition, HTML switch proposal, and CSS appearance-switching discussion. Determine and document the semantic reason to choose a switch over a checkbox, including how indeterminate checkboxes should be treated; the explainer and eventual specification should give authors clear guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, html
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100