Skip to content

Use checkVisibility for element visibility and add Locator.Visible() - #84

Open
kblok wants to merge 1 commit into
mainfrom
port/visibility
Open

kblok wants to merge 1 commit into
mainfrom
port/visibility

Conversation

@kblok

@kblok kblok commented Oct 6, 2026

Copy link
Copy Markdown
Member

Our visibility check skipped `checkVisibility()` on WebKit and faked `

Details` with a `closest()` lookup. That missed a closed outer `
` around an open inner one, and light DOM children that no slot renders. Upstream now calls `checkVisibility()` on every browser, plus one WebKit workaround for list box options, which have no renderer there. This change ports that logic.

The `visible=` selector engine had its own copy of the logic and never called `checkVisibility()`. It now uses the same function. The role engine also calls `checkVisibility()` now, and it ports upstream's `display:contents` handling so a `display:contents` button still counts as visible. `locator.Visible()` is added as a shortcut for `Filter(visible: true)`, to match upstream.

Closes #30, closes #58

🤖 Generated with Claude Code

Port upstream isElementVisible: rely on Element.checkVisibility on every
browser (it handles nested <details> and unslotted shadow content), with
the WebKit list box option workaround. The visible= selector engine now
shares the same function, and the role engine uses checkVisibility with
upstream's display:contents handling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Port missing upstream tests from page/locator-misc-2.spec.ts (1) Port missing upstream tests from page/locator-is-visible.spec.ts (3)

1 participant