Accessibility: DataGrid must have proper labelling and follow ARIA grid patterns for complex data tables (@microsoft/fluentui-jsx-a11y/datagrid-needs-labelling)
💼 This rule is enabled in the ✅ recommended config.
DataGrid components must have accessible labelling for screen readers to understand the data structure and purpose.
This rule enforces that DataGrid components have proper accessible names and follow ARIA grid patterns for complex data tables. DataGrids present tabular data that requires clear identification for assistive technology users.
DataGrids must have an accessible name provided through one of these methods:
aria-labelattribute with descriptive textaria-labelledbyattribute referencing existing label elements- Wrapping in a
Fieldcomponent that provides labeling context
// Missing any form of accessible labeling
<DataGrid columns={columns} items={employees} />
// Empty or whitespace-only labels
<DataGrid aria-label="" columns={columns} items={data} />
<DataGrid aria-label=" " columns={columns} items={data} />
// Invalid aria-labelledby reference
<DataGrid aria-labelledby="non-existent-id" columns={columns} items={data} />// Using aria-label
<DataGrid
aria-label="Employee directory"
columns={columns}
items={employees}
/>
// Using aria-labelledby with existing elements
<Label id="data-grid-title">Sales Report Q3 2024</Label>
<DataGrid
aria-labelledby="data-grid-title"
columns={columns}
items={salesData}
/>
// Wrapped in Field component
<Field label="Product Inventory">
<DataGrid columns={productColumns} items={inventory} />
</Field>
// Best practice: Include row/column counts for large datasets
<DataGrid
aria-label="Financial data with 500 rows and 12 columns"
aria-rowcount={500}
aria-colcount={12}
columns={columns}
items={financialData}
/>- Descriptive Labels: Use clear, descriptive labels that explain the data's purpose
- Data Context: Include information about the data type (e.g., "Employee directory", "Sales report")
- Size Hints: For large datasets, consider mentioning approximate size in the label
- Multiple Labels: Use
aria-labelledbyto reference multiple elements for richer context
This rule should always be used for DataGrid components as they present complex tabular data that requires clear identification for screen reader users.
table-needs-labelling- Similar requirements for Table componentsfield-needs-labelling- Field wrapper component labeling