Skip to content

fix(aria): annotate aria-hidden elements in AI snapshots - #42268

Open
triemerge wants to merge 1 commit into
microsoft:mainfrom
triemerge:fix/aria-hidden-annotation
Open

fix(aria): annotate aria-hidden elements in AI snapshots#42268
triemerge wants to merge 1 commit into
microsoft:mainfrom
triemerge:fix/aria-hidden-annotation

Conversation

@triemerge

@triemerge triemerge commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Rationale

The AI-mode snapshot (mode: "ai") intentionally includes aria-hidden elements because they are visually visible, but nothing distinguishes them from ARIA-visible content. When a test fails and error-context.md is generated, agents (and humans) see content that getByRole and ariaSnapshot() will never find, with no indication why.

This adds an [aria-hidden] annotation following the same bracket pattern as [checked], [disabled], [expanded] etc. Elements included only through visual visibility (not ARIA visibility) now render with [aria-hidden] in the key. Default-mode snapshots are completely unaffected since they exclude these elements entirely.

Fixes #42223

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]: error-context.md Page snapshot includes content excluded by ariaSnapshot()

1 participant