Repository navigation
fix(site/src/modules/workspaces/WorkspaceSharingForm): include visible text in sharing control names - #32137
Conversation
…lected role in role select names The workspace sharing role selects show "Use" or "Admin", but their accessible names were only "Role for <member>" and "Role". Speech input users who say the visible text could not activate them (WCAG 2.5.3). The names now end with the selected role, for example "Role for alice: Use".
…or group label after a selection Once a user or group is selected, the trigger shows only the selection, so its accessible name lost "Search for user or group" (WCAG 2.5.3). A hidden label now precedes the selection in the name, for example "Search for user or group Platform Engineering". Callers that pass their own triggerAriaLabelledBy keep it.
| triggerRef={triggerRef} | ||
| /> | ||
| <> | ||
| <span id={labelId} hidden> |
There was a problem hiding this comment.
is hidden the idiomatic approach here? I know elsewhere we use the sr-only class, but if there's precedent please ignore this!
There was a problem hiding this comment.
sr-only would make screen readers read the label twice, so hidden is intentional here. aria-labelledby still includes content it points to directly, even when that content is hidden (I checked the name in Chromium: "Search for user or group developer"). An sr-only span stays in the accessibility tree, though, so a screen reader reading through the page would hear "Search for user or group" as plain text and then again in the button's name. With no selection the span isn't referenced at all, so sr-only would just leave a stray copy of the placeholder next to the button.
ChatDragAnnouncer.tsx is the only other place that uses hidden for this. If we want to standardize on sr-only (or on hidden), that would be a separate PR, since this one is scoped to WorkspaceSharingForm.
🤖 Generated by Coder Agents on behalf of @aqandrew.
definitely defined
Two workspace sharing controls had accessible names that did not contain their visible text, so speech input users could not activate them by saying what they see (WCAG 2.5.3, Label in Name).
triggerAriaLabelledBy(ProjectAccessDialog) keep it.Closes DEQ-266
Closes DEQ-603
No screenshots: only accessible names change, so nothing looks different.
Already fixed on
mainby #31873, so this PR does not touch them: DEQ-204 (AI Bridge client and model filter search), DEQ-336 (Find organization search), DEQ-606 (Agents "Search workspaces..." picker), and element 2 of DEQ-266 (the "Search for user or group" search input).Grouping and decision log
speech-accessible-name-missinghas 5agent-oktickets: DEQ-204, DEQ-266, DEQ-336, DEQ-603, DEQ-606. DEQ-603 and DEQ-606 have no project set and were added on request.labelon everyCommandwith a search input. In Storybook onmain, the inputs are named "Search client", "Search model", "Find organization" and "Search workspaces". No change needed.aria-label="Role for <name>"after the audit, which replaced the visible value in the name. The fix appends the selected role to that label.modules/workspaces/WorkspaceSharingForm/UserOrGroupAutocomplete, which renders the trigger on the Agents Share flyout and in workspace sharing. It reuses the existingProjectAccessDialogpattern (aria-labelledby="<label> <trigger>"). The labelledby applies only while a value is selected. With no selection the placeholder is already the visible text and the name, so it is not repeated. The label ishiddeninstead ofsr-only, so screen readers do not read it as stray text in browse mode.aria-labelledbystill uses it.useId()instead of the literalworkspace-user-or-group-autocomplete, becausearia-labelledbynow references it and FE6 requires generated ids. Nothing insite/srcorsite/e2ereferenced the literal.pages/AgentsPage/ChatSharingPopover/EmptyACL), after picking "developer" the trigger is named "Search for user or group developer", and axe-core 4.11.1 reports no WCAG violations.ProjectRoleSelectinProjectAccessDialoghas the same role select pattern as DEQ-266.TemplatePermissionsPage/UserOrGroupAutocompleteandACLPrincipalAutocompletelose their label after a selection, like DEQ-603.🤖 Generated by Coder Agents on behalf of @aqandrew.