pixiebrix-extension
pixiebrix-extension copied to clipboard
A11Y and label issues with switch component
Describe the bug
- The switch component we use for forms and other isolated controls has a few issues (we use
BootstrapSwitchButton)- The switch is not focusable. I.e. you can't tab into it and can't toggle it with enter/space
- The switch is not labelled properly. I.e. the label next to it is not connected properly to it as a form control. (i.e. the
label elementfor` does not point to anything)- If it were labelled properly, it would be selectable/focusable if you clicked on the label, and it would be queryable by external locators (i.e. playwright
findByLabel)
- If it were labelled properly, it would be selectable/focusable if you clicked on the label, and it would be queryable by external locators (i.e. playwright
Screenshots/Loom
Recording: https://www.loom.com/share/d66e6da1133b44a8a19f49a2334e2a63
Code refs
https://github.com/pixiebrix/pixiebrix-extension/blob/a8d392018f377779a34e5a5236be5d586db205d7/src/components/fields/schemaFields/widgets/BooleanWidget.tsx#L38 https://github.com/pixiebrix/pixiebrix-extension/blob/main/end-to-end-tests/pageObjects/basePageObject.ts#L98-L101