[RAC 1.18.0] Switch no longer toggles on Enter — intentional change? #10175
-
SummaryIn Specifically, Enter no longer toggles the Switch after the Switch API refactor ( I’d like to understand whether this was intentional, and whether Switch should support Enter per accessibility guidelines. What changed in 1.18.0 (documented)The release notes describe:
There is no mention of keyboard interaction changes. Observed behavior
Why I think this changed (not documented)In 1.18.0, On the hidden In 1.17.0, Enter could still toggle via the label’s So the 1.18.0 refactor seems to fix Enter-on-label for toggles generally, which removes Enter toggling for Switch as a side effect. Accessibility questionThe W3C APG Switch pattern lists both Space and Enter as keys that toggle a switch. React Aria’s useSwitch docs currently describe Space only (Tab to focus, Space to toggle). For Checkbox, Enter not toggling aligns with APG. Questions for the team
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Supporting Enter on checkboxes/switches/radios previously was a bug. The native input type=checkbox only handles Space because Enter submits the form. #10145 (comment) IMO it's strange that switches would behave differently from checkboxes, not sure why the APG has that. The native Why is supporting Enter vs Space important for your app? |
Beta Was this translation helpful? Give feedback.
Supporting Enter on checkboxes/switches/radios previously was a bug. The native input type=checkbox only handles Space because Enter submits the form. #10145 (comment) IMO it's strange that switches would behave differently from checkboxes, not sure why the APG has that. The native
<input type="checkbox" switch>attribute currently supported by Safari only supports Space as well.Why is supporting Enter vs Space important for your app?