Skip to content

fix(web): list a checkbox or radio its own label draws over no box - #1595

Merged
okwasniewski merged 25 commits into
e2e-inc:mainfrom
samanyudas:fix/web-list-boxless-checkbox
Nov 10, 2026
Merged

okwasniewski merged 25 commits into
e2e-inc:mainfrom
samanyudas:fix/web-list-boxless-checkbox

Conversation

@samanyudas

@samanyudas samanyudas commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1355. This branch contains #1355's commits. Merge #1355 first, then review only the commits after dd7d3580. Without #1355, the node this PR lists can't be clicked (see Verified).

What and why

  • Element Plus shrinks its native checkbox to a 0x0 box under the box its <label> draws (.el-checkbox__original { opacity: 0; width: 0; height: 0; position: absolute; z-index: -1 }).
  • isHidden (packages/web/src/in-page/read-semantics.ts) treats a box with no size as hidden, and the walk lists only elements that are not hidden. So the agent saw box and text="Agree", with no checkbox and no checked state. A tap that ticked the box reported "No listed node changed".
  • The walk now lists a checkbox or radio that is hidden only by having no box, while a label of its own draws it (isDrawnByLabel). The node is marked not hidden, as the walk already does for a closed select's options, because agent code skips hidden nodes (packages/e2e/src/agent/reading.ts:64).
  • A tap on that node clicks the label (pickStandIn in packages/web/src/actions.ts, from fix(web): check a radio or checkbox through its own label when the label covers it #1355). So a label counts only when that click can work: it has a box of its own (not display: contents) and holds no link or other control besides its own. pickStandIn refuses a label whose centre lands on a link, so the reader rule is the stricter of the two. A checkbox under such a label stays out, as before this PR, and the agent reaches it through the label text or the drawn box.
  • The locator path is unchanged. screen.getByRole('checkbox', 'Agree') still reads the input as hidden, as Playwright's toBeVisible does.
  • Chrome's accessibility tree lists such an input, so the cross-check now agrees on the labelled ones. A shrunk control with no rendered label element still shows a person nothing and stays out. Those two cases, the display: contents label, and the label holding a link are recorded in tests/crosscheck/expected.txt with the reason.
#root document "Element Plus checkbox"
 #n2 checkbox "Agree" [checked focused]   <- was missing
 #n3 box
 #n4 text="Agree"

Issue

Fixes #1593

Verified

Ran it locally: yes

main reader (#1355 head dd7d3580) this branch this fix on main, without #1355
#n2 box, #n3 text="Agree": no checkbox #n2 checkbox "Agree" #n2 checkbox "Agree"
tap #n3: No listed node changed within the wait after this action, though toBeChecked() then passes tap #n2: changed #n2 checkbox "Agree" [checked] tap #n2 failed: ACTION_FAILED: tap did not become actionable in time: elementHandle.click: Timeout 2750ms exceeded. element is not visible
check false: changed #n2 checkbox "Agree" (was: ... [checked]), check: [checked] again check #n2 failed: ... element is not visible
  • e2e mcp on a page with the Element Plus checkbox, the same box under a display: contents label, and an Element Plus "Accept the Terms and Conditions" label holding a link:
control head before review (ae1dfada) this branch (a29cc91f)
Element Plus "Agree" #n2 checkbox "Agree", tap #n2: [checked] same
display: contents label #n6 checkbox "Contents", tap #n6 failed: ACTION_FAILED: tap did not become actionable in time: the control and its labels are not visible no checkbox node. tap on text="Contents" ticks it, toBeChecked() passes
label with a Terms link #n7 checkbox "Accept the Terms and Conditions", tap #n7 failed: ACTION_FAILED: ... element is not visible no checkbox node. tap on the drawn box ticks it, toBeChecked() passes. A tap on the label text lands on the link (path /#went), as on main
  • check-actions.test.ts taps every checkbox or radio an observation lists over no box, so a reader rule that lists one the tap refuses fails it. Removing any guard in isDrawnByLabel (visibility, skipped content of a slotted input, the type check, display: contents, the link check, the control's own exclusion) fails at least one test.
  • The cross-check fixture controls drawn by their label failed before the fix with five chrome missing lines and passes after it with the two recorded ones. The benchmark cross-check (CROSSCHECK_BENCHMARK_URL) passes too, so no benchmark scenario's tree moved.
  • read-node-checked.test.ts fails without the hidden = false override (expected true not to be true).
  • The web-benchmark agent suite (--strict-cache, CI=1) has the same 7 failures on dd7d3580 and on this branch. All 7 need a model call, and there was no AI_GATEWAY_API_KEY locally.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved

🤖 Generated with Claude Code

View guided diff

samanyudas and others added 15 commits October 26, 2026 11:48
…bel covers it

Element Plus hides the native input under its label's styled spans or
gives it no box, so Playwright's hit-target check refused it. check,
uncheck, and tap now click the label at the input's point when the
element at that point is the label's own content, or the input's first
label with a box when the input has none; anything else on top, a
disabled input, an input on top itself, or a boxless input whose labels
are all hidden is clicked as before.

One in-page read decides whether a label stands in, so a tap on anything
else pays that read and keeps locator.click, under one deadline. A
locator that never appears still fails NOT_ACTIONABLE within one timeout.

Fixes e2e-inc#1276

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ls, and links over the input

A control a disabled fieldset holds is refused by :disabled, not only
the attribute. A boxless control picks a label that is rendered
(checkVisibility), since visibility: hidden keeps its box. No label
stands in when the element at the click point, the input's centre or a
boxless label's centre, is a link, button, or other interactive
descendant of the label: the click would press that instead, and a tap
could follow a link. The locator's label resolution runs under the
action's remaining deadline.

Docs: uncheck reaches a checkbox only, the boxless case needs a visible
label, and a link or button in the label still fails.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n unrendered control

The stand-in was decided once from elementFromPoint, so a loading mask on
top, or a dialog not open yet, sent the click to the input, which its label
then covered until the deadline. The choice now reads the stack at the
input's point past anything outside the control and its labels, so
Playwright's checks on the label wait the mask out, and is polled while
nothing of the control is rendered, failing NOT_ACTIONABLE at the deadline.

One evaluateHandle returns the label itself, so the index and the second
resolve are gone. A point outside the label's box clicks the input as
before, and a tap on anything else returns before scrolling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se the null handle

The surface abandons a cancelled or timed-out operation without stopping
it, so a stand-in read still in flight went on to click. The signal is now
checked right before both click paths. The handle `pickStandIn` returns
for a control clicked as itself is disposed instead of living until the
page navigates.

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

A `let` initialised to `null` narrows to `null`, and TypeScript does not
see the assignment inside the poll callback, so the old code needed an
`as` cast and a comment. Declared without an initialiser, the variable
keeps its declared type after the poll. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each "still refuses" case waited out the 2s deadline twice (check, then
tap). `perform` now takes a timeout, and those cases pass 500ms. The file
drops from about 102s to 48s locally.

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

# Conflicts:
#	packages/web/src/actions.ts
…rved ref does

Since e2e-inc#1571 an observed ref's handle is made on first use from the walk's
in-page array. Building the check-actions element target the same way runs
every label stand-in case on the path an agent step takes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Element Plus shrinks its native checkbox to a 0x0 box under the label it
draws. Chrome's accessibility tree lists the control, and the tree leaves
it out, so an agent sees the label text with no checkbox and no state
(e2e-inc#1593). This page fails the cross-check with five `chrome missing` lines
until the reader lists the labelled ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reader treats a box with no width or height as hidden, as
Playwright's `toBeVisible` does, and leaves hidden elements out of the
observation. Element Plus shrinks its native checkbox to 0x0 under the
box its label draws, so the agent saw the label text with no checkbox and
no checked state, and a tap that ticked it reported no change (e2e-inc#1593).

The walk now lists such a control while a label of its own renders, and
marks it not hidden, as it does a select's options. Chrome's accessibility
tree keeps the input, so the cross-check agrees on the labelled ones. A
shrunk control with no rendered label element still shows a person
nothing and stays out, recorded in expected.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…locator calls hidden

Agent code skips a node whose hidden state is true, so the listed control
must read as shown, while the locator path keeps Playwright's visibility.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…der does, and say locators still call it hidden

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size:L Up to 499 changed lines, not counting tests, fixtures, or the lockfile label Nov 6, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 11 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread docs/reference/screen.mdx Resolved
Comment thread .changeset/check-through-label.md Resolved
Comment thread packages/web/src/actions.ts Resolved
samanyudas and others added 2 commits November 6, 2026 23:18
The hit check runs at the point the click lands, so a cover elsewhere over
the drawn box does not fail it, and uncheck refuses a native radio before
any click.

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

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of samanyudas

Ready for human review on ae1dfada: all 25 checks pass, the branch is up to date with main, and every review thread is resolved. This account cannot add the Ready for Human Review label.

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Automated review by Claude Code on behalf of maintainers.

Reviewed only the commits after dd7d3580 (head ae1dfada). The fix is small and well scoped. display:none, closed <details> and visibility:hidden inputs still stay hidden, so only the zero-box case gets listed. The per-node cost is negligible. Two things need changing first.

Must fix

  1. Three guards in isDrawnByLabel (read-semantics.ts:1116-1117) are untested. I removed each one in turn, and read-node-checked, visibility and crosscheck all still passed:
    • style.visibility !== 'visible': without it, <label><input style="opacity:0;width:0;height:0;position:absolute;visibility:hidden" type=checkbox>Agree</label> gets listed. Chrome drops it, so the cross-check would silently drift. Please add this case to the controls drawn by their label fixture or to read-node-checked.test.ts.
    • isSkippedContent(el): without it, an input inside a content-visibility:hidden region with a for= label outside that region gets listed.
    • The checkbox/radio type check: without it, any zero-box input with a label gets listed.
  2. The reader lists a checkbox that #1355's tap can't reach. The reader and pickStandIn in actions.ts each check "a label of its own renders", and they disagree on display:contents labels.
    • The reader uses !isHidden(label), which counts a display:contents label as visible when a child is.
    • pickStandIn needs a non-empty getBoundingClientRect(), which a display:contents label never has.
    • Probe: <label style="display:contents"><input class=shrunk type=checkbox><span class=box></span>Agree</label>. The reader lists checkbox "Agree", and a tap on it fails with NOT_ACTIONABLE: the control and its labels are not visible once the full timeout runs out.
    • Before this PR the agent tapped the text, which works, so this case is a regression.
    • Please use one predicate for both, or at least make both treat display:contents the same way, and add a test.

Nits

  • A disabled box-less checkbox is listed as disabled, which is right. Tapping it fails with element is not visible instead of a not-enabled error, because pickStandIn returns null for :disabled and the tap falls back to the input.
  • The isDrawnByLabel JSDoc is longer than repo norm.
  • The docs and changeset rely on #1355 ("a tap on it clicks the label"), so #1355 has to land first, as the body says.

Ran: clean tsc and oxlint. Vitest on read-node-checked, visibility, check-actions, crosscheck, observation and read-node-states: 147 passed. Mutations: 4 of 7 caught (dropping the hidden=false override, ignoring whether the label renders, needing no label, reverting the whole fix). The 3 above survive. Probed 12 edge cases against Chrome's accessibility tree.

For the maintainer: scope is the zero-box case only. CSS checkboxes that hide the input with visibility:hidden or display:none and draw the box with label::before stay invisible to the agent, as in Chrome's tree. Chrome lists aria-labelledby-only controls, and controls whose 0-size label has overflowing text. The reader lists neither, and expected.txt doesn't record them.

This was an automated review.

samanyudas and others added 2 commits November 7, 2026 07:37
The reader listed a box-less checkbox under a `display: contents` label,
which counts as shown while a child paints. A tap clicks the label in its
place (`pickStandIn`), which needs a box the label never has, so the tap
failed `the control and its labels are not visible` where tapping the
label text used to work. The reader now counts only a label with a box.

Tests pin each guard of `isDrawnByLabel`: visibility, a slotted input in
skipped content, the checkbox or radio type, and the `display: contents`
label. A new action test taps every checkbox or radio an observation lists
over no box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tap on a box-less checkbox clicks its label, and `pickStandIn` refuses
when the label's centre lands on a link, so the click follows no link.
The reader still listed such a checkbox ("Accept the Terms and
Conditions" in Element Plus), and its tap failed `element is not
visible`. The reader now counts only a label that holds no link or
control besides its own, which is stricter than the tap, so it lists no
checkbox the tap refuses.

The action test now uses only box-less controls and checks each one has
no box. The docs say when the agent sees only the label text.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread docs/web.mdx Resolved
@okwasniewski
okwasniewski dismissed their stale review November 6, 2026 22:21

Superseded by re-review of a29cc91

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Automated review (agent-run triage).

Re-review of a29cc91. Both earlier must-fixes are done:

  • The three guards are tested.
  • A display: contents label is skipped, and the new check-actions test taps every listed checkbox.

All 9 mutations are caught. The link exclusion doesn't regress anything: on main and #1355 a zero-box input was never listed, and a normal-input terms checkbox behaves the same as before. One gap is left.

Must fix

  • An interactive label is not checked. At read-semantics.ts:1118-1123 the reader runs label.querySelectorAll(INTERACTIVE), which never checks the label element itself. pickStandIn (actions.ts:123-124) uses hit.closest(INTERACTIVE), which does match the label.
    • Probe: <label class="el-checkbox" role="button"> around a zero-box input. On this branch it is listed as checkbox "Agree", and tapping it fails with NOT_ACTIONABLE after the full timeout.
    • On main and #1355 the checkbox isn't listed, and tapping the label text checks it, so this is a regression.
    • The same applies to role="link" and contenteditable labels.
    • Fix: add !label.matches(INTERACTIVE) && to the predicate, plus a case in the "leaves out..." test.

Nits

  • expected.txt:6 and the isDrawnByLabel JSDoc say the tap "refuses when the label holds a link". It only refuses when the label's centre lands on one. The reader's stricter rule is fine, but the wording should match.
  • Still open from before: tapping a disabled zero-box checkbox fails with "not visible", and #1355 lands first.

Ran

  • Vitest on read-node-checked, visibility, check-actions, crosscheck, observation, read-node-states and actions: 187 passed.
  • tsc and oxlint: clean.
  • Range-diff against ae1dfad: only the two new commits changed.

…box's label

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

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of samanyudas

Both must-fix items from @okwasniewski's review are addressed in 6273827 and a29cc91. CI passed on a29cc91, and 0dab444 after it changes one docs sentence. Again, review only the commits after dd7d3580.

Untested guards. Each guard in isDrawnByLabel now fails a test when removed:

  • visibility: read-node-checked and the cross-check fixture.
  • isSkippedContent: read-node-checked. The walk already stops at a content-visibility: hidden element, so this guard matters only for an input slotted into a skipped shadow region, which is the case the test uses.
  • The checkbox/radio type check: read-node-checked (a zero-box text input with no padding or border).

The reader listed a checkbox the tap could not reach. The reader now counts a label only when pickStandIn's click can use it:

  • It has a box of its own, so a display: contents label does not count.
  • It holds no link or control besides its own input. A fresh-context review found this second gap: an Element Plus "Accept the Terms and Conditions" label whose centre is the link. pickStandIn refuses it so the click follows no link, but the reader listed the checkbox.
  • The reader rule is stricter than the tap, so a new check-actions test taps every checkbox or radio an observation lists over no box. A reader rule that lists one the tap refuses fails it.

Through the built e2e mcp:

control ae1dfada a29cc91f
display: contents label checkbox "Contents" listed, tap fails the control and its labels are not visible not listed; a tap on its text ticks it
label with a Terms link checkbox "Accept the Terms and Conditions" listed, tap fails element is not visible not listed; a tap on the drawn box ticks it

Nits.

Not done here. A checkbox under a label with a link is now left out rather than listed and tappable. Listing it would need #1355's pickStandIn to click a non-link point of the label instead of refusing. That changes a refusal #1355 pins on purpose, so it would be a follow-up after #1355 lands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

View guided diff | Re-trigger cubic

samanyudas and others added 5 commits November 7, 2026 13:09
A locator that matches another control after the state read must still
click the control it read. Removing the pinned element from setChecked
fails the new case.

uncheck on an Element Plus checkbox clears it through its label, and on
an Element Plus radio it is refused with no click. Turning the label
stand-in off fails it.

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

A label with role="button", role="link", or contenteditable listed its
box-less checkbox, but a tap on it fails NOT_ACTIONABLE, because
pickStandIn's closest() check matches the label itself. The reader now
skips such a label too, so the agent taps the label, as on main.

The JSDoc, the cross-check reason, and docs/web.mdx now say the tap
refuses only when the label's centre lands on a link, and that the
reader's rule is stricter.

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

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of samanyudas

The interactive-label must-fix is in 5ca7075. fe9bd76 merges #1355's new test commit.

  • isDrawnByLabel now also requires !label.matches(INTERACTIVE). The "leaves out..." test in read-node-checked.test.ts has role="button", role="link", and contenteditable label cases. Before the fix, all three failed.
  • Nit fixed: the JSDoc, the expected.txt reason, and docs/web.mdx now say the tap refuses only when the label's centre lands on a link. They also say the reader's rule is stricter.

I checked your probe through the built e2e mcp, using an Element Plus checkbox under a role="button" label and another under a role="link" label:

e18c9ecc 5ca70756
tree button "Agree" > checkbox "Agree" button "Agree", no checkbox
tap the checkbox: ACTION_FAILED ... element is not visible after the full timeout the label: toBeChecked() passes

The role="link" label gave the same results.

Ran: pnpm check exit 0. The @e2e-dev/web suite passed 780 tests with 1 skipped. On the merged tree, check-actions + read-node-checked passed 91 tests.

Still left for #1355: a tap on a disabled box-less checkbox fails with "not visible".

@okwasniewski

Copy link
Copy Markdown
Member

Automated review by Claude Code on behalf of maintainers.

Re-checked at fe9bd76c. The CR 2 fix is right: isDrawnByLabel now refuses a label that matches INTERACTIVE, and removing it fails read-node-checked "leaves out a box-less control...". Reader and pickStandIn agree on interactive labels, labels nested in a button/link, and multiple labels; where they still differ (link anywhere in the label, aria-hidden label) the reader lists less, which is the safe side. 129 targeted tests pass, CI green. Labeled Ready.

Optional nits:

  • check-actions.test.ts: add a <label role="button"> case to the tap-every-listed-node fixture so that test alone would catch a reader/tap split.
  • docs/web.mdx:262: rewrap, and "Locators still call that control hidden" reads as the link; say "the checkbox".

Maintainers, follow-up: the INTERACTIVE selector is duplicated in read-semantics.ts and actions.ts (in-page functions, can't import); pass it in from one constant or assert they match.

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@samanyudas

Copy link
Copy Markdown
Contributor Author

thanks!

No worries!

@okwasniewski
okwasniewski merged commit 12c6c01 into e2e-inc:main Nov 10, 2026
25 checks passed
kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Nov 11, 2026
* Click a checkbox or radio through its own label (upstream e2e-inc/e2e#1595)

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

* Throw on cancel before the plain click in ClickControlAsync

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

* Restart CI

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

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Nov 12, 2026
…1571)

* Click a checkbox or radio through its own label (upstream e2e-inc/e2e#1595)

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

* Throw on cancel before the plain click in ClickControlAsync

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

* Extract isDrawnByLabel so a box-less checkbox or radio is listed only when its label draws it (upstream e2e-inc/e2e#1595)

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

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Human Review size:L Up to 499 changed lines, not counting tests, fixtures, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web: the observation drops a checkbox whose input has a 0x0 box (Element Plus el-checkbox)

2 participants