Improve accessibility labels and localize picker buttons#11456
Improve accessibility labels and localize picker buttons#11456danielchalmers merged 7 commits intoMudBlazor:devfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refines accessibility and localization by converting ARIA/action labels to sentence case, adding dynamic show/hide swatch labels, and localizing picker adornment buttons.
- Standardizes resource strings to sentence case and trims lengthy ARIA labels
- Adds localized, state-dependent labels for color swatch toggling and tree-view expansion
- Replaces hard-coded picker aria labels with localized defaults
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/MudBlazor/Resources/LanguageResource.resx | Updated many resource values to sentence case; added new keys for show/hide swatches and open/expand actions |
| src/MudBlazor/Components/TreeView/MudTreeViewItemToggleButton.razor | Injected localizer and added dynamic aria-label based on expand/collapse state |
| src/MudBlazor/Components/TimePicker/MudTimePicker.razor.cs | Removed static AdornmentAriaLabel and set localized fallback in OnInitialized |
| src/MudBlazor/Components/DatePicker/MudDateRangePicker.razor.cs | Removed static AdornmentAriaLabel but no localized fallback added |
| src/MudBlazor/Components/DatePicker/MudBaseDatePicker.razor.cs | Added localized default for AdornmentAriaLabel in OnInitialized |
| src/MudBlazor/Components/ColorPicker/MudColorPicker.razor.cs | Localized AdornmentAriaLabel on init |
| src/MudBlazor/Components/ColorPicker/MudColorPicker.razor | Switched to dynamic, localized show/hide swatches aria-label |
Comments suppressed due to low confidence (4)
src/MudBlazor/Components/DatePicker/MudDateRangePicker.razor.cs:31
- The static
AdornmentAriaLabelwas removed but no localized fallback was added, leaving the button without an aria-label. Consider addingAdornmentAriaLabel ??= Localizer[LanguageResource.MudDateRangePicker_Open];inOnInitializedto maintain accessibility.
AdornmentAriaLabel = "Open Date Range Picker";
src/MudBlazor/Components/TreeView/MudTreeViewItemToggleButton.razor:15
- Remove the redundant '@' before
Localizerinside the razor expression. It should be@(Expanded ? Localizer[LanguageResource.MudTreeView_CollapseItem] : Localizer[LanguageResource.MudTreeView_ExpandItem])for valid syntax.
aria-label="@(Expanded ? @Localizer[LanguageResource.MudTreeView_CollapseItem] : @Localizer[LanguageResource.MudTreeView_ExpandItem])" />
src/MudBlazor/Components/TimePicker/MudTimePicker.razor.cs:550
Localizeris referenced here but not injected or defined in this code-behind. Add an[Inject] InternalMudLocalizer Localizer { get; set; }property (or similar) so that this reference compiles and runs correctly.
AdornmentAriaLabel ??= Localizer[LanguageResource.MudTimePicker_Open];
src/MudBlazor/Resources/LanguageResource.resx:262
- [nitpick] Replacing specific close labels like "Close Alert" or "Close Picker" with a generic "Close" reduces context for screen-reader users. Consider retaining element context (e.g., "Close alert") for clarity.
<value>Close</value>
|
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (75.00%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #11456 +/- ##
=======================================
Coverage 91.13% 91.13%
=======================================
Files 465 466 +1
Lines 14412 14417 +5
Branches 2790 2795 +5
=======================================
+ Hits 13134 13139 +5
Misses 641 641
Partials 637 637 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
meenzen
left a comment
There was a problem hiding this comment.
Localization looks correct, I will pull the LanguageResources changes into MudBlazor.Translations once this is merged.



Description
How Has This Been Tested?
Type of Changes
Checklist
dev).