Repository navigation
fix(aria): skip text nodes that are not rendered - #42982
Closed
Yuriy Mikityuk (yuriy-mikityuk) wants to merge 1 commit into
Closed
Yuriy Mikityuk (yuriy-mikityuk) wants to merge 1 commit into
Yuriy Mikityuk (yuriy-mikityuk) wants to merge 1 commit into
Conversation
Light dom text of a shadow host that is not assigned to a slot, and text directly inside a closed details, are not rendered. Playwright only checked the visibility of the parent element, so this text leaked into aria snapshots and accessible names. For example, a web component with unslotted "Light" text and "Shadow" in its shadow root got the name "LightShadow" instead of "Shadow".
Collaborator
|
Yuriy Mikityuk (@yuriy-mikityuk) Please start with filing an issue, according to the contributing guide. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two cases where text isn't rendered but still ends up in aria snapshots and accessible names:
"Light" is not assigned to any slot, so the button is named "Shadow" in Chromium's accessibility tree, but Playwright named it "LightShadow" and
getByRole('button', { name: 'Shadow', exact: true })found nothing. "Details" sits directly inside a closed details, and the snapshot showed- group: Summary Details, same as for an open one.Unslotted elements are already treated as hidden, but text nodes were only checked through their parent, which is visible in both cases. Added
isTextNodeHiddenForAriaand used it in the aria snapshot and in the accessible name computation.