classic-design-system
classic-design-system copied to clipboard
[Feat?]: add 'enter' keypress to Switch component
Duplicates
- [X] I have searched the existing issues
Latest version
- [X] I have tested the latest version
Summary 💡
Current Checkbox is supporting using "enter" key but Switch component does not. In order to be consistent, we need to update Switch to use the same keypress functionality:
Checkbox code: https://github.com/pluralsight/design-system/blob/master/packages/checkbox/src/react/index.tsx#L86
Examples 🌈
No response
Motivation 🔦
Improve a11y functionality and consistency.
In native elements, only space
toggles a checkbox. This is because when a form element has focus and enter
is pressed, the form is submitted.
I think we should re-evaluate this approach, as well as our current checkbox in favor of removing toggle on enter
functionality, knowing that there is a potentially negative impact to this. Or perhaps controlling this behavior with a flag that defaults to true
to preserve existing functionality?