Repository navigation
fix: Only use Title as aria-label on buttons without visible text - #5591
Merged
Vincent Baaij (vnbaaij) merged 2 commits intoNov 4, 2026
Merged
Conversation
Title was always copied into aria-label, so a button with text lost its visible text as accessible name (WCAG 2.5.3, Label in Name). Now Title becomes the aria-label only when the button has no Label or ChildContent.
p6laris
requested review from
Denis Voituron (dvoituron) and
Vincent Baaij (vnbaaij)
as code owners
November 4, 2026 07:12
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The conditional Title handling removes explanatory tooltips and can leave icon-only buttons and links with custom SVG content without an accessible name.
2 open issues
What changed in this PR
This PR addresses #5590 by preventing button titles from overriding visible text in accessible names across five Fluent UI Blazor components.
Changes:
- Conditionally emit
Titleasaria-labelwhen noLabelorChildContentis supplied. - Add text-content and icon-only regression tests for each affected component.
- Update two snapshots to omit the accessible-name override.
| File | Description |
|---|---|
| tests/Core/Components/Button/FluentToggleButtonTests.razor | Adds title accessibility tests. |
| tests/Core/Components/Button/FluentMenuButtonTests.razor | Adds title accessibility tests. |
| tests/Core/Components/Button/FluentCompoundButtonTests.razor | Adds title accessibility tests. |
| tests/Core/Components/Button/FluentCompoundButtonTests.FluentCompoundButton_Title.verified.razor.html | Removes the expected aria-label. |
| tests/Core/Components/Button/FluentButtonTests.razor | Tests accessible naming and tooltip retention. |
| tests/Core/Components/Button/FluentButtonTests.FluentButton_Title.verified.razor.html | Removes aria-label while retaining title. |
| tests/Core/Components/Button/FluentAnchorButtonTests.razor | Adds title accessibility tests. |
| src/Core/Components/Button/FluentToggleButton.razor | Makes the title-derived label conditional. |
| src/Core/Components/Button/FluentMenuButton.razor | Makes the title-derived label conditional. |
| src/Core/Components/Button/FluentCompoundButton.razor | Checks content before emitting the title-derived label. |
| src/Core/Components/Button/FluentButton.razor | Makes the title-derived label conditional. |
| src/Core/Components/Button/FluentAnchorButton.razor | Makes the title-derived label conditional. |
Review effort: Balanced
…and compound buttons
Denis Voituron (dvoituron)
approved these changes
Nov 4, 2026
Vincent Baaij (vnbaaij)
approved these changes
Nov 4, 2026
This was referenced Nov 16, 2026
Merged
Closed
This was referenced Nov 30, 2026
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.

Pull Request
📖 Description
Buttons with text and a
Titlewere getting the title as theiraria-label, so the accessible name lost the visible text (WCAG 2.5.3). NowTitleonly becomes thearia-labelwhen there's noLabelorChildContent, the same checkicon-onlyalready uses. This covers FluentButton, FluentAnchorButton, FluentCompoundButton, FluentMenuButton and FluentToggleButton. FluentSplitButton was already fine since itsaria-labelis on the arrow-only toggle.🎫 Issues
Fixes #5590
👩💻 Reviewer Notes
Two snapshots lose their
aria-label(FluentButton_Title and FluentCompoundButton_Title). That's intended.📑 Test Plan
I added two tests per component: with text there's no
aria-label, and icon-only keepsTitleas itsaria-label. The text tests and the two snapshots fail without the fix. All of tests/Core passes (5207). I didn't run the demo or try a screen reader.✅ Checklist
General
Issue discussion declaration
Discuss changes before implementing them to confirm that the problem and proposed approach fit the project. See Discuss before implementing for the process and exceptions.
AI contribution declaration
AI assistance is allowed; fully AI-generated or autonomous pull requests without meaningful human review are not accepted. See the AI contribution policy.
Component-specific
MCP Server
⏭ Next Steps
None.