Description of the issue
<pf-switch /> lacks an accessible static label. The current label uses the state of the switch as the label.
Impacted component(s)
Steps to reproduce
Basic Demo
- Go to the
<pf-switch /> "Basic" demo.
- When clicking the switch, the message changes from "Message when on" to "Message when off". These messages incorrectly act as the label for the switch.
Without Label Demo
- Go to the "Without Label" demo.
- This demo lacks an accessible label and accessible states for its controls.
Other demos
Similarly, the "Checked with label" and "Disabled" follow these trends and need fixed.
Expected behavior
All <pf-switch /> elements should include an accessible label for the control.
- They should also have an
aria-describedby attribute that targets the controls toggled state options.
- If a
<label> isn't used, the switch needs an accessible-label property/attribute.
Proposed fixes:
<label for="with-label">Switch B</label>
<pf-switch id="with-label" aria-describedby="b" checked>
<div id="b">
<span data-state="on">Message when on</span>
<span data-state="off" hidden>Message when off</span>
</div>
</pf-switch>
<pf-switch aria-describedby="a" accessible-label="Switch A" checked>
<div id="a">
<span data-state="on">Message when on</span>
<span data-state="off" hidden>Message when off</span>
</div>
</pf-switch>
Related to RedHat-UX/red-hat-design-system#1513 (comment).
Description of the issue
<pf-switch />lacks an accessible static label. The current label uses the state of the switch as the label.Impacted component(s)
<pf-switch />Steps to reproduce
Basic Demo
<pf-switch />"Basic" demo.Without Label Demo
Other demos
Similarly, the "Checked with label" and "Disabled" follow these trends and need fixed.
Expected behavior
All
<pf-switch />elements should include an accessible label for the control.aria-describedbyattribute that targets the controls toggled state options.<label>isn't used, the switch needs anaccessible-labelproperty/attribute.Proposed fixes:
Related to RedHat-UX/red-hat-design-system#1513 (comment).