fix(web): label six forms for screen readers - #6068
Conversation
Add accessible names and error links to six forms. Follow issue Kilo-Org#4172. The password show/hide buttons now stay in the keyboard tab order. They have aria-label, aria-pressed, and aria-controls. The length rule is linked to the password input. The other changes link a label to its input in the Create Town dialog, mark the Invite Member email input invalid and link its error, name the app prompt and TTFB search inputs, and link the Wasteland name error and organization selector. Add a server-render test for the password fields.
The first pass had defects. This commit corrects them. - Add the React import that the Jest JSX transform needs. The new test now runs. - Make RadioGroup a real radiogroup. It now forwards aria props. The ownership label works. - Name the Invite Member role trigger and the app builder icon buttons. - Remove the fixed aria-label from the Wasteland organization select. It hid the selected value. - Announce the Wasteland setup error with role alert. - Name the Add Model search input. - Drop the redundant aria-required attribute from the Create Town input. - Check both password visibility toggles in the test.
RadioGroup now forwards ARIA props. Set role only where the group has a label, so unnamed groups are not announced.
| <DropdownMenu> | ||
| <DropdownMenuTrigger asChild> | ||
| <Button | ||
| id="role" |
There was a problem hiding this comment.
WARNING: id="role" overrides Radix's generated trigger id, breaking the menu's accessible name
Radix's DropdownMenuTrigger assigns the trigger a generated id, and DropdownMenuContent renders aria-labelledby={context.triggerId} pointing back at that trigger. Because asChild merges the child's props last, this explicit id="role" replaces the generated id, so the popup's aria-labelledby references an id that is no longer in the DOM, stripping the role="menu" popup of its accessible name. The trigger already has an aria-label, so this id is unnecessary; remove it (or point aria-labelledby at a dedicated label element) instead of overriding Radix's internal id.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| type="button" | ||
| tabIndex={-1} | ||
| onClick={() => setShowPassword(!showPassword)} | ||
| aria-label={showPassword ? 'Hide password' : 'Show password'} |
There was a problem hiding this comment.
SUGGESTION: Keep the toggle button's accessible name constant when using aria-pressed
aria-pressed already exposes the toggled state, and the WAI-ARIA APG recommends keeping a toggle button's accessible name constant. Changing the name to "Hide password" while aria-pressed="true" makes screen readers announce "Hide password, pressed", which is contradictory. Keep the name as "Show password" on both visibility toggles (this line and line 141) and let aria-pressed convey the state.
| aria-label={showPassword ? 'Hide password' : 'Show password'} | |
| aria-label="Show password" |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe new Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (9 files)
Fix these issues in Kilo Cloud Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
Problem
Issue #4172 asks for accessible labels on web forms. Six of the listed forms still fail the acceptance criteria:
Change
This class of defect shares one cause: a control has no programmatic identity, or its validation text is not linked. This PR fixes the six forms together.
PasswordFormFields: keep the show/hide buttons in the tab order. Addaria-label,aria-pressed, andaria-controls. Link the length rule to the password input.CreateTownDialog: link the label to the input withhtmlForandid.InviteMemberDialog: setaria-invalidandaria-describedbyon the email input. Name the role trigger.PromptInput: name the text area and the icon-only send and stop buttons.TtfbAlertingContentandAddModelDialog: name the search inputs.NewWastelandWizardClient: link the name and organization errors. Add a named ownership radiogroup.RadioGroup: forward ARIA props. This lets callers label a group.Tests
Add a server-render test for the password fields. It checks both toggle buttons, the keyboard reachability, the toggle state, the linked length rule, and the hidden state when protection is off.
Verification
pnpm exec tsgo --noEmit(apps/web) passes.pnpm exec oxlintpasses on all changed files.oxfmtpasses on all changed files.renderToStaticMarkupundertsx. All assertions pass. CI runs the full suite.RadioGrouplabel, an unnamed role trigger, a select label that hid the selected value, unnamed icon buttons, and a missing live region on the setup error.Refs #4172.