Skip to content

fix(react-accordion): use inert='true' string attribute instead of boolean on closed panel#36074

Open
Copilot wants to merge 7 commits intomasterfrom
copilot/fix-accordion-inert-attribute
Open

fix(react-accordion): use inert='true' string attribute instead of boolean on closed panel#36074
Copilot wants to merge 7 commits intomasterfrom
copilot/fix-accordion-inert-attribute

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

React warns when a boolean is passed for a non-boolean DOM attribute, and React 19 also warns when an empty string is used for the inert attribute. AccordionPanel was setting inert: true on the root div when the panel is closed. This fix uses 'true' as the string value for inert with a TypeScript cast to resolve the type compatibility issue.

Changes

  • useAccordionPanel.ts: Replaced inert: true with ...((open ? {} : { tabIndex: -1, inert: 'true' }) as React.HTMLAttributes<HTMLDivElement>) — prevents keyboard focus from entering the closed panel while avoiding React DOM warnings
  • AccordionPanel.test.tsx: Updated assertions to verify inert is set to 'true' when the panel is closed and undefined when open
  • Change file: Added beachball change file for @fluentui/react-accordion (patch)

Copilot AI changed the title [WIP] Fix inert property type on Accordion component fix(react-accordion): use empty string for inert attribute instead of boolean Apr 28, 2026
Copilot AI requested a review from dmytrokirpa April 28, 2026 20:17
@dmytrokirpa
Copy link
Copy Markdown
Contributor

@copilot generate changelog file with yarn change

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 29, 2026

@copilot generate changelog file with yarn change

Done — added the beachball change file for @fluentui/react-accordion (patch) in commit f7a41a0.

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@dmytrokirpa dmytrokirpa marked this pull request as ready for review April 29, 2026 05:44
@dmytrokirpa dmytrokirpa requested review from a team and ValentinaKozlova as code owners April 29, 2026 05:44
…ccordionPanel when closed

Agent-Logs-Url: https://github.com/microsoft/fluentui/sessions/a189f5ea-ede2-4409-8997-58bfb92e907f

Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
Copilot AI changed the title fix(react-accordion): use empty string for inert attribute instead of boolean fix(react-accordion): use aria-hidden instead of inert attribute on closed panel Apr 29, 2026
Copilot AI requested a review from dmytrokirpa April 29, 2026 17:40
… on closed AccordionPanel

Agent-Logs-Url: https://github.com/microsoft/fluentui/sessions/16951f74-723b-4a57-b75a-6fbdc66a4601

Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 29, 2026

@copilot generate changelog file with yarn change

The changelog file is already present from a previous commit. No additional action needed.

Copilot AI changed the title fix(react-accordion): use aria-hidden instead of inert attribute on closed panel fix(react-accordion): use empty string for inert attribute instead of boolean Apr 29, 2026
@dmytrokirpa dmytrokirpa requested a review from mainframev April 29, 2026 20:22
// tabIndex: -1 prevents the panel itself from being focused, and inert prevents
// all focusable descendants from being reachable via keyboard navigation.
...(open ? {} : { tabIndex: -1, inert: true }),
...((open ? {} : { tabIndex: -1, inert: '' }) as React.HTMLAttributes<HTMLDivElement>),
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.

@copilot inert: '' results in warning for Rect 19, lets try inert: 'true'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in commit 965543c. Changed inert: '' to inert: 'true' and updated the test assertion accordingly.

Copilot AI changed the title fix(react-accordion): use empty string for inert attribute instead of boolean fix(react-accordion): use inert='true' string attribute instead of boolean on closed panel Apr 30, 2026
Copilot AI requested a review from dmytrokirpa April 30, 2026 08:36
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]: inert property is set as boolean on Accordian when it should be a string

2 participants