Skip to content

docs(react-examples): fix GroupedList example a11y - #36489

Draft
AKnassa wants to merge 1 commit into
microsoft:masterfrom
AKnassa:ak-issue-33765-groupedlist-example-roles
Draft

docs(react-examples): fix GroupedList example a11y#36489
AKnassa wants to merge 1 commit into
microsoft:masterfrom
AKnassa:ak-issue-33765-groupedlist-example-roles

Conversation

@AKnassa

@AKnassa AKnassa commented Aug 1, 2026

Copy link
Copy Markdown

Previous Behavior

The GroupedList "custom header and footer" documentation examples (V1 and V2) returned plain divs with no ARIA roles. Those divs sit directly inside the list's treegrid, which is only allowed to contain rows — so accessibility scanners (like Accessibility Insights, as reported in the issue) flag the example, and anyone copying it ships the same problem.

New Behavior

The example header and footer carry the same semantics as the built-in group header: a row containing a gridcell, with the standard level/position/expanded attributes on the header. Visually nothing changes — the added wrappers are unstyled.

What changed

  • Both example files (GroupedList.Custom.Example.tsx and GroupedListV2.Custom.Example.tsx) updated with the role pattern the built-in GroupHeader uses.
  • Verified by rendering the example and asserting the row/gridcell structure (the original markup demonstrably lacks it), plus an axe pass on the fixed example; the react-examples build (the CI type gate) succeeds.
  • No release-notes file needed — the examples package is private.

One honest note: current axe versions descend through generic divs and no longer flag this pattern by themselves, but the ARIA structure requirement is real and the scanner in the issue does flag it. The built-in GroupFooter has the same flaw at component level — left as a follow-up since changing component DOM could affect existing apps.

Related Issue(s)

The GroupedList 'custom header and footer' examples (V1 and V2)
return role-less divs from onRenderHeader/onRenderFooter. Those land
directly inside the role="treegrid" list, which only allows row and
rowgroup children, so accessibility scanners flag
aria-required-children and screen readers get a malformed grid.

Give the custom header and footer the same semantics as the built-in
GroupHeader row: role="row" with a role="gridcell" child, plus
aria-level/setsize/posinset/expanded on the header (the props are
already populated by both GroupedList versions). Visual output is
unchanged - the added inner divs are unstyled.

Verified: header/footer now carry row+gridcell semantics and axe
aria-structure rules pass on the rendered example; the react-examples
build (CI type gate) succeeds; lint and prettier clean. The built-in
GroupFooterBase has the same flaw at component level - left for a
follow-up since changing component DOM could affect consumers.

Fixes microsoft#33765
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs]: GroupedList example with custom header and footer has a11y issue

1 participant