Skip to content

Conversation

agg23
Copy link
Contributor

@agg23 agg23 commented Aug 6, 2025

Resolves #36938.

Implement the somewhat vague inert HTML attribute spec for our accessibility tree.

My interpretation is that nodes are marked hidden, equivalent to aria-hidden, if they possess the inert attribute. This cascades to all "flat tree descendants", which are the standard descendants plus special handling for shadow DOM.

Some nodes can additionally opt out (by virtue of their tag, not by specifying a property, as it is not possible to supply an explicit false flag to inert, just the absence of the attribute). The spec lists modal dialogs as an example of a tag that escapes inert.

This opt out behavior is not supported by this PR

@agg23 agg23 requested a review from dgozman August 6, 2025 18:18
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Test results for "tests 1"

2 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079:7 › cli codegen › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:104:3 › should work with strict CSP policy @firefox-ubuntu-22.04-node18

46599 passed, 805 skipped
✔️✔️✔️

Merge workflow run.

@agg23 agg23 merged commit 6e3392b into microsoft:main Aug 7, 2025
32 checks passed
@Mamaduka
Copy link

Hey, folks

It seems this was shipped with v1.55, though the linked issue is labeled for the next version. This is probably worth mentioning in the changelog: the locators targeting elements with an inert attribute will fail without includeHidden: true.

@mxschmitt
Copy link
Member

thanks @Mamaduka - I'll bring it up in the team meeting later.

agg23 added a commit to agg23/playwright that referenced this pull request Aug 21, 2025
@agg23
Copy link
Contributor Author

agg23 commented Aug 21, 2025

Reverting in #37137

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]: Elements with an inert="" attribute aren't hidden from the accessibility tree
5 participants