fix: Title becomes the accessible name in FluentButton
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #5591 by @p6laris — merged
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- accessibility, frontend
Research direction
Start with FluentButton.razor, where the issue says aria-label="@Title" is set, and inspect the icon-only check mentioned in the report. Then check how the same behavior is applied in the five other named button components and look for the FluentButton_Title snapshot. Done when Title remains a tooltip, the accessible name includes the visible text, and the affected snapshot reflects the expected output.
Written by the indexing model from the issue text.
Description
🐛 Bug Report
If a FluentButton has both text and a Title, the Title ends up as the aria-label, so the accessible name no longer contains the visible text. FluentAnchorButton, FluentCompoundButton, FluentMenuButton, FluentSplitButton and FluentToggleButton do the same.
💻 Repro or Code Sample
<FluentButton Title="Write a query first.">Run</FluentButton>
🤔 Expected Behavior
The accessible name stays "Run" and Title stays a tooltip.
😯 Current Behavior
It renders this on 5.0.0 and 5.0.1:
<fluent-button role="button" aria-label="Write a query first." title="Write a query first." ...>Run</fluent-button>
That fails WCAG 2.5.3 (Label in Name). Someone using voice control who says "click Run" won't hit the button, and a screen reader reads the tooltip instead of "Run".
💁 Possible Solution
It comes from aria-label="@Title" in FluentButton.razor. Maybe only set it when there's no Label or ChildContent, the same check icon-only already uses. Icon-only buttons would keep their name, and the FluentButton_Title snapshot would change. I'm happy to send a PR if that sounds right to you. Until then, passing aria-label explicitly works around it.
🔦 Context
I was adding explanatory tooltips to disabled buttons and noticed the button name changed to the tooltip text.
🌍 Your Environment
- OS & Device: Windows 11 on PC
- Browser: not relevant, the attributes come from the server render (checked with bUnit)
- .NET and Fluent UI Blazor library Version: .NET 10.0.401 and Microsoft.FluentUI.AspNetCore.Components 5.0.0 and 5.0.1
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 495
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 69
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/fluentui-blazor
-
a11y
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microsoft/fluentui-blazor#5546 ·
Maintainers usually reply within 1 day
-
[FluentTabs]: Screen reader does not announce the accessible name and role for the Delete Tab buttonOpena11y
Difficulty 2/5 Half a day Newbie friendliness 72/100
microsoft/fluentui-blazor#5540 ·
Maintainers usually reply within 1 day
-
a11y
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/fluentui-blazor#5539 ·
Maintainers usually reply within 1 day
-
a11y
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microsoft/fluentui-blazor#5538 ·
Maintainers usually reply within 1 day
-
a11y
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/fluentui-blazor#5537 ·
Maintainers usually reply within 1 day
All issues in microsoft/fluentui-blazor
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Unity-Technologies/unity-agent-plugin#118 ·
Maintainers usually reply within 1 day
-
The Recommended preset turns on Import Uno DSP, which only works with the Material themePossibly taken @agneszitte claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
unoplatform/uno.templates#2388 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
eyalgolan/statecraft-israel#2732 ·
Maintainers usually reply within 1 day
-
要トリアージ
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
kind/chore status/draft
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Altinn/altinn-events#1158 ·
Maintainers usually reply within 1 day