Skip to content

fix(ByRole): treat inert elements as inaccessible - #1393

Open
YodHeVauHe wants to merge 2 commits into
testing-library:mainfrom
YodHeVauHe:cursor/fix-inert-role-queries-5181
Open

YodHeVauHe wants to merge 2 commits into
testing-library:mainfrom
YodHeVauHe:cursor/fix-inert-role-queries-5181

Conversation

@YodHeVauHe

Copy link
Copy Markdown

Fixes #1364.

isSubtreeInaccessible never checked element.inert, so role queries still found inert elements. A defined, truthy element.inert is now treated as inaccessible. Attribute presence is not used, so environments without the property stay unchanged. hidden: true still includes those elements.

npm test -- --runInBand src/__tests__/role.js -t "excludes inert elements by default but includes them with hidden: true" passed: 1 test (27 skipped in that file).

cursoragent and others added 2 commits October 4, 2026 11:03
Co-authored-by: ZaSourceCode <YodHeVauHe@users.noreply.github.com>
Role queries already honor hidden: true by skipping the inaccessible
filter, so inert elements remain queryable when that option is set.

Co-authored-by: ZaSourceCode <YodHeVauHe@users.noreply.github.com>
@codesandbox-ci

codesandbox-ci Bot commented Oct 4, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ca965c2:

Sandbox Source
react-testing-library-examples Configuration

This branch has not been deployed

No deployments
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.

Elements with an inert="" attribute aren't being hidden from the accessibility tree

2 participants