Skip to content

fix(react-headless-components-preview): default aria-hidden on NavCategoryItem's expandIcon slot - #36690

Open
Ray Knight (ArrayKnight) wants to merge 1 commit into
microsoft:masterfrom
ArrayKnight:fix/headless-nav-category-item-aria-hidden-36685
Open

fix(react-headless-components-preview): default aria-hidden on NavCategoryItem's expandIcon slot#36690
Ray Knight (ArrayKnight) wants to merge 1 commit into
microsoft:masterfrom
ArrayKnight:fix/headless-nav-category-item-aria-hidden-36685

Conversation

@ArrayKnight

Copy link
Copy Markdown
Contributor

Griffel's @fluentui/react-nav marks the decorative expand chevron aria-hidden: true by default on both useNavCategoryItem_unstable and useNavCategoryItemBase_unstable. The headless useNavCategoryItem re-implements the expandIcon slot with slot.optional (no default glyph, unlike the base hook's slot.always) but dropped that aria-hidden default in the process. As a result, any expandIcon a consumer supplies (other than an untitled Fluent icon, which self-hides via @fluentui/react-icons) leaks into the button's accessible name.

This restores defaultProps: { 'aria-hidden': true } on the slot, matching the base hook. It remains overridable: slot.always spreads {...defaultProps, ...props}, so a consumer passing expandIcon={{ 'aria-hidden': false, ... }} still wins.

Fixes #36685.

Extracted from #36656 — each in-tree fix from that PR as an isolated change.

…egoryItem's expandIcon slot

The Griffel react-nav hooks default the decorative expand chevron to
aria-hidden: true; the headless NavCategoryItem re-implements the slot
without that default, so any expandIcon a consumer supplies (other than
an untitled Fluent icon, which self-hides) leaks into the button's
accessible name.

Fixes microsoft#36685.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused accessibility fix is covered by tests and has no unresolved issues.

Pull request overview

Restores correct accessible naming for headless NavCategoryItem expand icons.

Changes:

  • Defaults expandIcon to aria-hidden.
  • Tests default behavior and consumer overrides.
  • Adds a patch change file.
File summaries
File Description
packages/react-components/react-headless-components-preview/library/src/components/Nav/NavCategoryItem/useNavCategoryItem.ts Adds the ARIA default.
packages/react-components/react-headless-components-preview/library/src/components/Nav/Nav.test.tsx Tests default and override behavior.
change/@fluentui-react-headless-components-preview-e4e832ae-9516-48ff-bcdb-4c477a4cc4d8.json Records the accessibility fix.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-headless-components-preview
react-headless-components-preview: entire library
240.515 kB
67.828 kB
240.547 kB
67.831 kB
32 B
3 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-headless-components-preview
@fluentui/react-headless-components-preview/tag-picker
54.012 kB
17.756 kB
react-headless-components-preview
@fluentui/react-headless-components-preview/teaching-popover
36.073 kB
12.006 kB
🤖 This report was generated against 5695ba9a88220b89b564d65bc10f0caf806b6610

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Pull request demo site: URL

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.

[Bug]: headless NavCategoryItem drops the aria-hidden default on its expandIcon slot, so a custom chevron leaks into the button's accessible name

3 participants