Data views: Improve the checkboxes labels #59178
Labels
[Feature] DataViews
Work surrounding upgrading and evolving views in the site editor and beyond
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
In the data views, the checkboxes are associated with visually hidden labels.
Each label text is prefixed with the text
Select item:
orDeselect item:
gutenberg/packages/dataviews/src/single-selection-checkbox.js
Line 22 in 80f0554
For clarity purpose, I made the visually hidden labels visible in the screenshot below. Reminder: so far, the checkboxes are visible only on hover, focus, or when they are checked.
I'm not sure a checkbox label text should ever dynamically report the state of the selection. This kind of labeling seems less than ideal to me. The selection state is a native HTML feature and it's already communicated visually and semantically
A label is meant to provide the name of the control, not its state.
Additioally, the current implementation is inspired to the Core list tables. In core, not everything is ideal and over time we couldn't change many things due to technical debt and bacwards compatibility issues. Specifically to these labels, I'm not even sure they should contain the word 'select' or 'deselect'. In a list of checkboxes, I wouldn't ever prefix each label with the those words. In a web form, the context of the checkboxes should be clarified by a fieldset legend. In this case, the checkboxes are in a table column and the context should be clarified by the table header. I will split the table header in a separat eissue but for now I'd recommend to drastically simplify these labels and remove any extraneous text. I'd recommend to keep just the item title.
Additionally, it's unlikely that speech recognition software users would ever be able to easily interact with these checkboxes by issuing a voice command. In fact, the visual labeling is given by the item title (although that's not a label, semantivcally) while the actual accessible name mismatches and it is prefixed with extraneous text.
Cc @joedolson @alexstine @andrewhayward
Step-by-step reproduction instructions
Select item: {title}
.Deelect item: {title}
.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: