Skip to content

Read an empty box as hidden and match mixed and absent role states - #1088

Merged
kblok merged 5 commits into
mainfrom
issue-1075-1076-visibility-role-states
Nov 4, 2026
Merged

kblok merged 5 commits into
mainfrom
issue-1075-1076-visibility-role-states

Conversation

@kblok

@kblok kblok commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

An element with an empty box read as visible, and GetByRole state options matched mixed and absent states that Playwright (and upstream) skip. Seven ported Playwright tests failed because of it; they ran behind ExpectedToFailAsync. This PR fixes the cause and removes the marker from them.

  • IsVisible, IsHidden, toBeVisible, toBeHidden, WaitFor and the visible option now treat an element with an empty box as not visible (LocatorEngine.IsNodeVisible). Upstream puts this in its hidden state (in-page/read-semantics.ts). The port keeps Hidden to the render rules, because role queries and the agent share it, so the page script sets a separate flag.
  • Checked or Pressed skip a mixed node (indeterminate checkbox, aria-pressed="mixed"). Expanded = false skips a node with no aria-expanded.
  • Level of a role="heading" element is its aria-level, else 2 (upstream level).

Upstream followed: tester-army/e2e at bdf769b (packages/web/src/in-page/read-semantics.ts; tests locator-is-visible.e2e.ts, selectors-role.e2e.ts).

Tests: no new upstream test. ExpectedToFailAsync is removed from LocatorIsVisibleTests (IsVisible_and_isHidden_should_work, IsVisible_inside_a_button, IsVisible_inside_a_role_button) and SelectorsRoleTests (Should_support_checked, _pressed, _expanded, _level). The Logo image in WebEngineTests gets a size, since an empty box is no longer visible.

.NET-only symbols: NodeStates.EmptyBox, NodeStates.Mixed, NodeStates.ExpandedAbsent (web only; upstream reads these as nullable or inside hidden, and the port's bool states are shared with mobile and Windows, so flags avoid a breaking change). One .NET-only test, IsNodeVisibleTests.Treats_a_node_with_an_empty_box_as_not_visible.

Known limits: actionability checks and the agent still read Hidden only, so a click on an empty element is not refused. Mixed is one flag for both Checked and Pressed.

Docs: COMPATIBILITY.md and the NodeStates API page.

Closes #1075
Closes #1076

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ls2e1yaZFgZ3FEJkYScfkK

…loses #1075, Closes #1076)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls2e1yaZFgZ3FEJkYScfkK
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 72f4f6e and c307e4c.

Files selected for processing: 12
  • COMPATIBILITY.md
  • docs-site/src/content/docs/api/E2E.Engine/NodeStates.md
  • src/E2E/Engine/Observation.cs
  • src/E2E/Engine/PageScript.cs
  • src/E2E/Engine/WebEngine.cs
  • src/E2E/Expect/Expect.cs
  • src/E2E/Locator/LocatorEngine.cs
  • src/E2E/Locator/Screen.cs
  • tests/E2E.NUnit.Tests/LocatorIsVisible/LocatorIsVisibleTests.cs
  • tests/E2E.NUnit.Tests/SelectorsRole/SelectorsRoleTests.cs
  • tests/E2E.Tests/LocatorEngine/IsNodeVisibleTests.cs
  • tests/E2E.Tests/WebEngineTests.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kblok

kblok commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kblok
kblok merged commit 85e973c into main Nov 4, 2026
4 checks passed
@kblok
kblok deleted the issue-1075-1076-visibility-role-states branch November 4, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant