Skip to content

MudDataGrid, MudTable: Add TableAttributes parameter - #12993

Merged
danielchalmers merged 11 commits into
MudBlazor:devfrom
NoahS2003:feature-datagrid-arialabel
Jul 12, 2026
Merged

MudDataGrid, MudTable: Add TableAttributes parameter#12993
danielchalmers merged 11 commits into
MudBlazor:devfrom
NoahS2003:feature-datagrid-arialabel

Conversation

@NoahS2003

@NoahS2003 NoahS2003 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Added a TableAttributes parameter to the MudDataGrid and MudTable that allows for HTML attributes on the underlying table element. This adds support for accessibility features like aria-label and aria-labelledby.

Deprecated the AriaLabel parameter on MudTable, as it can be set by TableAttributes.

Checklist:

  • I've read the contribution guidelines
  • My code follows the style of this project
  • I've added or updated relevant unit tests

@mudbot mudbot Bot changed the title DataGrid: Add AriaLabel parameter MudDataGrid: Add AriaLabel parameter Apr 7, 2026
@mudbot mudbot Bot added accessibility Accessibility concerns (ARIA, keyboard, focus, screen readers, contrast) enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library labels Apr 7, 2026
@NoahS2003

Copy link
Copy Markdown
Contributor Author

Related to #12642, but that issue seems to be specific to the SelectColumn rather than the root table element.

@danielchalmers danielchalmers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better in general to use aria-labelledby for this as it should already be labeled somewhere on the screen anyway? Or add a TableAttributes property so people can use either one? This could be done in MudTable as well in addition to deprecating the AriaLabel property on there.

@danielchalmers danielchalmers added the needs: info This issue/PR lacks key context (goal, setup, environment) label Apr 17, 2026
@NoahS2003

Copy link
Copy Markdown
Contributor Author

@danielchalmers Will do. I think the generalized TableAttributes will add more value, so I'll do that. Is there an existing process for deprecating a parameter? I can't find it in the contributing guidelines.

@danielchalmers

danielchalmers commented Apr 28, 2026

Copy link
Copy Markdown
Member

Is there an existing process for deprecating a parameter?

We typically just mark with [Obsolete] but keep it functional. Then in the next major release we remove it along with associated tests/logic.

Example:

        [Parameter]
        [Category(CategoryTypes.Table.Behavior)]
        [Obsolete("Set via TableAttributes....etc")]
        public string? AriaLabel { get; set; }

@mudbot mudbot Bot removed the needs: info This issue/PR lacks key context (goal, setup, environment) label Apr 29, 2026
@danielchalmers
danielchalmers marked this pull request as draft June 1, 2026 16:36
@NoahS2003 NoahS2003 changed the title MudDataGrid: Add AriaLabel parameter MudDataGrid, MudTable: Add TableAttributes parameter Jul 9, 2026
@NoahS2003
NoahS2003 marked this pull request as ready for review July 9, 2026 17:47
@NoahS2003

Copy link
Copy Markdown
Contributor Author

@danielchalmers

Is there an existing process for deprecating a parameter?

We typically just mark with [Obsolete] but keep it functional. Then in the next major release we remove it along with associated tests/logic.

Example:

        [Parameter]
        [Category(CategoryTypes.Table.Behavior)]
        [Obsolete("Set via TableAttributes....etc")]
        public string? AriaLabel { get; set; }

I can't seem to keep it functional with it marked obsolete, it looks like there are some build rules that throw errors when obsolete parameters are used. Is there a way to get around that?

Comment thread src/MudBlazor/Components/Table/MudTable.razor Outdated
Comment thread src/MudBlazor.Docs/Pages/Components/DataGrid/DataGridPage.razor Outdated
@NoahS2003
NoahS2003 requested a review from danielchalmers July 9, 2026 19:56
Splat the table attributes ahead of the framework class so a stray
class/style key in TableAttributes cannot override mud-table-root /
TableClassname. Matches the @attributes-before-class convention used
across the rest of the library.
@danielchalmers danielchalmers added the breaking change This change will require consumer code updates (ex: removes/changes an API) label Jul 12, 2026
@danielchalmers
danielchalmers merged commit 3f9612e into MudBlazor:dev Jul 12, 2026
10 checks passed
@danielchalmers

Copy link
Copy Markdown
Member

Thank you!

This was referenced Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Accessibility concerns (ARIA, keyboard, focus, screen readers, contrast) API change Modifies the public API surface in a non-breaking way (ex: adds a new property) breaking change This change will require consumer code updates (ex: removes/changes an API) enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants