Repository navigation
Conversation
Button passed unknown props straight to the <button>, so `ariaLabel` (used in the Button stories, and the prop name used by Input and MenuItem) ended up as a meaningless `arialabel` attribute and the button had no accessible name. Add an ariaLabel prop that renders `aria-label`. The native `aria-label` prop still works and takes precedence. Implements LIBS-734 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexcpn
force-pushed
the
LIBS-734/button-aria-label
branch
from
December 4, 2026 13:44
8a75289 to
4a409c4
Compare
|
This branch has not been deployed
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.



Implements LIBS-734
Relates to LIBS-716 (make
aria-labelprops consistent across UI components)Description
InputandMenuItemtake anariaLabelprop, and the Button stories useariaLabeltoo (button.prod.stories.js). ButButtonhad no such prop: it spreadariaLabelonto the<button>as an unknown attribute. The DOM ended up witharialabel="...", which assistive technology ignores, so an icon-only button still had no accessible name. The "missing title and ariaLabel" debug message also fired, because it only checkedaria-label.The existing test
has the accessibility attributesasserted this broken attribute (toHaveAttribute('ariaLabel', ...), which matchesarialabelbecause HTML attribute names are case-insensitive).This PR:
ariaLabelprop toButtonthat rendersaria-labelaria-labelprop working. It is spread after, so it takes precedence if both are passed (no change for current users)ariaLabelin the missing-label debug checkariaLabeltoButtonPropsin the types (onlyButton, notBaseButtonProps, sinceSplitButton/DropdownButtondon't forward it) and regeneratesAPI.mdHow it was tested
ariaLabel(getByRole('button', { name })); nativearia-labelstill works; nativearia-labelwins when both are set; no debug warning when onlyariaLabelis set. The existing accessibility test now assertsaria-labeland the absence ofarialabel.master, three of these fail (including the updated existing test). With the change, all 26 button tests pass.eslintandprettier --checkare clean (one existingreact-hooks/exhaustive-depswarning inbutton.jsis untouched).Known issues
button.js/Button.test.js, as does fix(button): prevent crash when loading changes on a translated page #1790 (approved, not yet merged). The changes are in different lines but may need a trivial rebase depending on merge order. I'll handle it.Checklist
The existing stories already pass
ariaLabel; with this change it now takes effect.AI disclosure
This change was written and tested by an AI model, Claude Opus 5.5 (via Claude Code), and submitted by a human contributor.
#T4G (tokens for good project)
🤖 Generated with Claude Code