Skip to content

fix(aria): process children of hidden elements #36316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Jun 16, 2025

Closes #36296

@Skn0tt Skn0tt requested a review from Copilot June 16, 2025 08:05
@Skn0tt Skn0tt self-assigned this Jun 16, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses processing of hidden elements for ARIA snapshots in response to issue #36296. Key changes include:

  • Adding a new test to verify that visible children of hidden elements are correctly captured.
  • Introducing the helper function isVisible in the ARIA snapshot generation, and modifying text node and element handling accordingly.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/page/page-aria-snapshot.spec.ts Adds a test verifying that visible children within hidden elements are processed.
packages/injected/src/ariaSnapshot.ts Introduces a new isVisible helper function and updates element processing logic to incorporate it.
Comments suppressed due to low confidence (2)

packages/injected/src/ariaSnapshot.ts:50

  • Consider adding a brief comment above the isVisible function to explain its purpose in determining element visibility for ARIA processing.
function isVisible(element: Element, options?: { forAI?: boolean }): boolean {

tests/page/page-aria-snapshot.spec.ts:662

  • [nitpick] For consistency with other test names, consider renaming the test title to begin with 'should', for example: "should show visible children of hidden elements".
it('show visible children of hidden elements', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/36296' }  }, async ({ page }) => {

Copy link
Contributor

Test results for "tests 1"

1 failed
❌ [webkit-library] › library/browsercontext-pages.spec.ts:105:3 › should return bounding box with page scale @webkit-ubuntu-22.04-node18

2 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:986:7 › cli codegen › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
⚠️ [webkit-page] › page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18

39384 passed, 822 skipped
✔️✔️✔️

Merge workflow run.

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]: ariaSnapshot hides visibility: visible inside visibility: hidden
1 participant