Give inputs unique ids so that SR doesn't skip Label announcement#3874
Merged
llastflowers merged 7 commits intomainfrom Jan 26, 2026
Merged
Conversation
…when initial selection changes
🦋 Changeset detectedLatest commit: 7d2e5c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Assign unique IDs to inputs for improved accessibility.
… github.com:primer/view_components into llastflowers/14774/region-label-sr-announcement-fix
… github.com:primer/view_components into llastflowers/14774/region-label-sr-announcement-fix
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the accessibility of the MultiInput form control so that screen readers consistently announce its label, and wires that behavior into the axe/preview tooling and metadata.
Changes:
- Ensure form labels have stable, unique
idattributes derived from the inputbase_id, and wire multi-input children to reference those labels viaaria-labelledby. - Update the
MultiInputDSL to give each constituent input a uniqueid, associate it with the shared label, and keep hidden inputs disabled while still present in the DOM. - Extend accessibility configuration (axe skip rules and static preview/info architecture JSON) for the
MultiInputvisually-hidden-label scenario and add a changeset for@primer/view-components.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
static/previews.json |
Updates the multi_input/visually_hide_label preview’s skip_rules.wont_fix to include the label-title-only rule so CI reflects the expected a11y exception. |
static/info_arch.json |
Mirrors the preview configuration by adding label-title-only to wont_fix for the multi_input/visually_hide_label preview entry in the information architecture metadata. |
lib/primer/accessibility.rb |
Adds a per-component wont_fix rule for Primer::Alpha::MultiInput’s visually_hide_label scenario and normalizes scenario_name (string vs symbol) before looking up scenario-specific axe rules. |
app/lib/primer/forms/form_control.html.erb |
Ensures every label rendered by the forms FormControl wrapper has a deterministic id (label-<base_id>) while still respecting any explicitly provided id. |
app/lib/primer/forms/dsl/multi_input.rb |
Adjusts decorate_options so each child input in a multi-input gets a unique id and an aria-labelledby pointing at the shared label, and keeps hidden inputs disabled to avoid server submission. |
.changeset/hip-flies-pretend.md |
Records a patch release for @primer/view-components summarizing the new unique-ID behavior for multi-input labels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
TylerJDev
approved these changes
Jan 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
Integration
N/A
List the issues that this change affects.
Addresses https://github.com/github/accessibility-audits/issues/14774
Risk Assessment
What approach did you choose and why?
The label was not being announced when the initial selection was changed because the inputs did not have unique IDs. Now that they have unique ids, the label will always be announced regardless of selection state.
Anything you want to highlight for special attention from reviewers?
N/A
Accessibility
Fix for a11y audit remediation issue
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.