Skip to content

fix(webkit): use native checkVisibility for element visibility - #42971

Merged
Yury Semikhatsky (yury-s) merged 3 commits into
microsoft:mainfrom
yury-s:webkit-check-visibility
Sep 28, 2026
Merged

Yury Semikhatsky (yury-s) merged 3 commits into
microsoft:mainfrom
yury-s:webkit-check-visibility

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • Use native Element.checkVisibility() in WebKit too; the WebKit bug that required the manual fallback is fixed for <details> and unslotted content.
  • Fixes content of a <details> nested inside a closed <details> being reported as visible in WebKit.
  • Drop the fallback for browsers without checkVisibility(); minimum supported versions are now Electron 21 and Chrome 105 on Android.

Supersedes #42951.

WebKit's checkVisibility now handles closed details and unslotted
content, so the manual workaround is only kept for browsers without it.
This fixes content of a details nested in a closed details being
reported as visible in WebKit.
Drop the manual details/summary fallback for browsers without
checkVisibility. Minimum supported versions are now Electron 21 and
Chrome 105 on Android.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures.

🔴 One failure looks caused by this PR

mcp/core.spec.ts:170 › browser_select_option (multiple) fails on WebKit on all three OSes. The <option>s inside <select multiple> no longer get [ref=…], so WebKit's native checkVisibility() now reports them as hidden.

Details

Checked against head b281472. The "tests 1" run is green apart from flakes. The MCP run has 5 failures in 3 groups. One group is a clear regression from the checkVisibility switch. One is a known flake. One is probably unrelated but not proven.

Caused by this PR

  • [webkit] › mcp/core.spec.ts:170 › browser_select_option (multiple): fails on ubuntu, macos and windows. The snapshot still lists the options, but they have lost their refs:
    -   - option "Foo" [ref=e3]
    +   - option "Foo"
    
    Refs only go to elements that pass isElementVisible. The PR removes the WebKit fallback in domUtils.ts::computeElementStyleVisibilityVisible and calls element.checkVisibility() unconditionally. WebKit returns false for <option> in a listbox, so those options are now treated as invisible. Before this PR the test had 0 failures in 738 WebKit runs. The fix probably belongs in computeElementStyleVisibilityVisible, for example by skipping checkVisibility() for OPTION/OPTGROUP, as the new roleUtils.ts comment already assumes. Also add a locator-is-visible test that covers options in <select multiple> on WebKit.

Pre-existing flake / infra

  • [firefox] › mcp/cli-core.spec.ts:57 › click link (windows): the click times out after "performing click action". The test-results DB has this test on firefox failing in 5 of 725 runs, including push runs on main and fix(aria): annotate aria-hidden elements in AI snapshots #42268. It flips verdict and has nothing to do with the visibility change.

Uncertain

Triaged by the Playwright bot - agent run

WebKit does not create renderers for options in a list box, so
checkVisibility() returns false for them.
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:301 › should report intercepted service worker requests in HAR `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`

52331 passed, 1243 skipped


Merge workflow run.

@yury-s
Yury Semikhatsky (yury-s) merged commit 814dbe7 into microsoft:main Sep 28, 2026
44 checks passed
@yury-s
Yury Semikhatsky (yury-s) deleted the webkit-check-visibility branch September 28, 2026 19:38
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8790 passed, 1480 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.

2 participants