fix: FluentDataGrid empty and loading states are not announced to screen readers

Open
#5,476 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, html

Research direction

Start with the FluentDataGrid rendering for DataGridRowState.EmptyContent and DataGridRowState.LoadingContent, then inspect the existing persistent sort status region and the DataGrid_EmptyContent resource. Check how the grid updates announcements when filtering leaves no rows. Done means the agreed behavior is announced to screen readers without changing table semantics; the issue leaves open whether to announce loading or item counts, so clarify that approach first.

Written by the indexing model from the issue text.

Description

a11y

🐛 Bug Report

Like #5473 for the paginator, the FluentDataGrid empty and loading states are not announced to screen readers.

When a filter (or a data refresh) leaves the grid empty, the "No data to show" row is displayed, but nothing is announced: the row is a newly inserted tr (DataGridRowState.EmptyContent), and screen readers only announce changes inside a live region that already exists. The same applies to the loading row (DataGridRowState.LoadingContent).

💻 Repro or Code Sample

  1. Open https://fluentui-blazor.net/DataGrid/GettingStarted with a screen reader.
  2. Type a filter that matches no item.
  3. "No data to show" is displayed but not announced.

🤔 Expected Behavior

The empty state (and possibly the loading state) is announced, so screen reader users know the result of their action.

💁 Possible Solution

The rows themselves can't be live regions (role="status" on a tr breaks the table semantics). The grid already renders a persistent live region for multiple sorting:

<div sort-status role="status" aria-live="polite">@_sortAnnouncement</div>

A possible approach: always render this region (it's empty by default), and also set its text when the grid becomes empty, using the existing DataGrid_EmptyContent resource (or the EmptyContent text).

Questions before I send a PR:

  • Should the loading state also be announced? It may be noisy when the data is refreshed often.
  • Would you rather announce the item count after a refresh (e.g. "12 items"), which covers the empty case too?

I'm happy to submit the PR once the approach is agreed.

Dominant language
C#
Stars
4.9k
Forks
497
Avg merge
1d 1h
Merged PRs (30d)
47

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/fluentui-blazor

All issues in microsoft/fluentui-blazor

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.