Closed poi33 closed 4 months ago
Good catch! We should fix this. Would you delight us with a PR? :D
After creating and better understanding the Switch component. I don't think any of these fields would improve the switch.
If its an option of two choices in a form submission, the aria-labels would not convey how to better use the part in a better way.
I think the part will be used (as I initially thought) for a functional switch on a page to toggle states (outside form). Like a dark - light theme toggler. This use case would require changes mentioned in this issue.
https://github.com/digdir/designsystemet/pull/2073#issuecomment-2140347060.
If we have a checkbox for forms and a switch for more settings simple toggles there should be a bigger refactor of the switch component. Like switching away from using an input element.
This is probably part of a bigger refactoring and the accessibility mentioned here should be of the refactored switch. Closing this as there might be an bigger refactor needed for the switch component.
Description of the bug
Steps To Reproduce
Render a switch component. Inspect it with a accessibility tool
The switch reads as a checkbox with the name "switch"
Additional Information
No response