Skip to content

[Bug]: Unrendered text ends up in accessible names and aria snapshots #43019

Closed

Description

Version

1.63.0 (also reproduces on current main)

Steps to reproduce

Repo: https://github.com/yuriy-mikityuk/playwright-aria-unrendered-text-repro

  1. npm ci
  2. npx playwright install
  3. npx playwright test

There are two tests. One has a div role=button with light DOM text "Light" and a shadow root that contains "Shadow" and no slot. The other has a closed <details> with text directly inside it.

Expected behavior

The button is named "Shadow", like in Chromium's accessibility tree, so getByRole('button', { name: 'Shadow', exact: true }) finds it. The snapshot of the closed details is - group: Summary.

Actual behavior

The button is named "LightShadow", so the locator finds nothing. The snapshot is - group: Summary Details, the same as for an open details. Both tests fail in all three browsers.

Additional context

Unslotted elements are already treated as hidden in roleUtils, but text nodes are only checked through their parent element, which is visible in both cases. I'd like to work on this. I have a fix with tests ready, it was #42982, closed because there was no issue yet.

Environment

System:
  OS: macOS 26.7
  CPU: (14) arm64 Apple M4 Pro
Binaries:
  Node: 20.20.2
  npm: 10.8.2
npmPackages:
  @playwright/test: 1.63.0 => 1.63.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions