Skip to content

fix(web): check a radio or checkbox through its own label when the label covers it - #1355

Closed
samanyudas wants to merge 13 commits into
e2e-inc:mainfrom
samanyudas:fix/web-check-through-label
Closed

samanyudas wants to merge 13 commits into
e2e-inc:mainfrom
samanyudas:fix/web-check-through-label

Conversation

@samanyudas

@samanyudas samanyudas commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What and why

  • Element Plus draws el-radio-button, el-radio, and el-checkbox with the native input under the label's styled spans (opacity: 0; z-index: -1), or with no box at all (width: 0; height: 0). Playwright's hit-target check accepts only the target or its descendants, so check, uncheck, and tap on the input failed NOT_ACTIONABLE (<span class="el-radio-button__inner"> intercepts pointer events, element is not visible), and an agent step on such a radio ended AUTOMATION_UNSUPPORTED. Plain Playwright .check() fails the same way.
  • clickControl (packages/web/src/actions.ts) now clicks a native checkbox or radio through its own label when, at the input's centre, the topmost element that is the input or inside one of its labels is label content (elementsFromPoint, so a loading mask or modal on top does not change the choice), or when the input has no box (then its first rendered label). The click lands at the input's point relative to the label, so a link elsewhere in the label is not what gets pressed. Playwright's actionability checks run on the label: they wait out a mask that goes away, and anything that stays on top still fails NOT_ACTIONABLE. The input is clicked as before when it is disabled (a disabled <fieldset>'s included, :disabled), is the topmost itself, has a link, button, or other interactive element of its label at the click point (so tap never follows a link), or has its centre outside the label's box.
  • One evaluateHandle (pickStandIn) returns the label itself, under the action's deadline. While neither the control nor any of its labels is rendered (a display:none or visibility:hidden dialog not open yet), the page throws and clickControl reads again through pollCondition until the deadline, then fails NOT_ACTIONABLE: ... the control and its labels are not visible. A tap on anything else pays that one read and keeps locator.click, re-resolving, under the same deadline. The operation's signal is checked right before either click, so a read still in flight when the operation is cancelled clicks nothing. A locator that never appears still fails NOT_ACTIONABLE (tap did not become actionable in time: ... waiting for locator(...)) within one timeout.
  • setChecked keeps polling the input's checked state after the label click.
  • Holds in a shadow root (getRootNode().elementFromPoint) and inside a frame (the frame's own viewport coordinates).
await screen.getByRole('radio', '安装').check();   // was ACTION_FAILED: intercepts pointer events
await screen.getByRole('checkbox', 'Agree').check(); // was ACTION_FAILED: element is not visible

Issue

Fixes #1276

Verified

Ran it locally: yes

  • packages/web/tests/integration/check-actions.test.ts, the a control its own label covers cases, through a locator and an element handle: check and tap on each of the three Element Plus shapes; each shape behind a mask removed after 300ms and inside a display:none or visibility:hidden container shown after 300ms (the review's repros, all 14 red on f74e0e3); a modal-covered and a disabled control that must stay NOT_ACTIONABLE and unchecked; a radio whose label covers it from outside the label's box; a boxless checkbox whose first label is hidden by display or by visibility and whose second is not, and one whose every label is hidden; a radio under a link in its own label and a boxless checkbox whose label has a link at its centre, both of which must stay NOT_ACTIONABLE, unchecked, and on the same URL; a radio-button inside <fieldset disabled>; a shadow root; a frame; a tap on a locator that never appears; an action cancelled while its stand-in read is in flight, which must click nothing. On this branch: Tests 75 passed (75); the full web suite Tests 642 passed | 1 skipped (643), pnpm check green.
  • Built CLI on a scratch project whose page carries the real theme-chalk CSS for the three controls (el-radio-button.css, el-radio.css, el-checkbox.css): three tests on the settled page, and each again behind a v-loading-style mask removed after 800ms and in a display:none container shown after 800ms. node node_modules/e2e/dist/cli/bin.js run, @e2e-dev/web built from main, from the previous head, and from this branch:
main f74e0e3 (previous head) this branch
Tests 9 failed | 0 passed (9), 180.67s Tests 2 failed | 7 passed (9), 65.21s Tests 9 passed (9), 7.51s
ACTION_FAILED: check did not become actionable in time: elementHandle.click: Timeout 29616ms exceeded. <span class="el-radio-button__inner">安装</span> intercepts pointer events: getByRole("radio", name: "安装") the two mask cases on radios: <span class="el-radio-button__inner">安装</span> intercepts pointer events, <span class="el-radio__inner"></span> intercepts pointer events ✓ |web| tests/element-plus.e2e.ts (3 tests) 1.08s
ACTION_FAILED: check did not become actionable in time: elementHandle.click: Timeout 29626ms exceeded. element is not visible: getByRole("checkbox", name: "Agree") ✓ |web| tests/late.e2e.ts (6 tests) 6.54s

Through the CLI the dialog case already passed on f74e0e3, because the role locator resolves only once the dialog is shown; the engine tests above reproduce it with raw locators and element handles.

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.

🤖 Generated with Claude Code

@mintlify

mintlify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 2e0883d.

Approve preview

@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 4 files

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

Comment thread docs/reference/screen.mdx Resolved
Comment thread packages/web/src/actions.ts Resolved
Comment thread packages/web/src/actions.ts Resolved
Comment thread packages/web/src/actions.ts Resolved
Comment thread packages/web/src/actions.ts Resolved
Comment thread docs/reference/screen.mdx Resolved

@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 for the thorough repro and the theme-chalk CSS fixtures. The direction makes sense: clicking a control's own label is how a real user's click reaches it, and Playwright's actionability checks still run on the label, so a modal or a link inside the label still blocks the click. On f74e0e3 I checked: the new tests pass (59/59), the full web suite passes (626 + 1 skipped), and pnpm check is green. Reverting packages/web/src/actions.ts to main makes 19 of the new cases fail, so the tests do catch the bug.

Must fix

  1. The stand-in is decided once, before Playwright's retry loop starts. clickControl (packages/web/src/actions.ts:160) calls pickStandIn once and keeps the answer. If the control isn't ready at that moment, the code falls back to a plain click on the input. Playwright then waits for the input to become actionable, but the label's span still covers it, so the click fails at the deadline. I reproduced this on this branch against the Element Plus radio-button fixture, with a 3s timeout, for both check and tap:

    • a full-page mask removed after 300ms (the v-loading pattern): NOT_ACTIONABLE ... <span class="el-radio-button__inner">安装</span> intercepts pointer events
    • the control inside a display:none container shown after 300ms (dialog or tab opening): same error

    A control rendered after 300ms passes, because locator.evaluate waits for attachment. Both failing cases are the normal way an Element Plus form shows up after navigation or when a dialog opens, so the fix only works on a page that is already settled. Please make the choice part of the wait. One option: poll in the page until the input's centre hits either the input itself or one of its own labels, or until the boxless case resolves, bounded by the deadline. Another: choose again whenever the click fails on hit-target. Please don't use a fixed delay or a retry count. Add tests for the two cases above.

  2. The label is resolved twice. pickStandIn returns a labelIndex, and then labelAt (actions.ts:164) runs a second evaluateHandle, with separate locator and element branches, to turn the index back into an element. That is an extra round trip and a window in which the DOM can change between the two reads. It is also why you need the StandIn interface (:96) and the standIn === null || label === null check. Return the label itself from a single evaluateHandle, or compute position in Node from input.boundingBox() and label.boundingBox(). The index, the interface, and one branch then go away.

Nits

  1. actions.ts:143: when the input's centre falls outside the label's box, the code clicks the label's centre. That point was never checked for links, which is the case f74e0e3 set out to rule out. Returning null there is simpler and safer.
  2. actions.ts:122: pickStandIn scrolls the page even when it returns null, which is the case for every tap on something that isn't a checkbox or radio. Return early for those before scrolling. Reordering the guards is enough.
  3. docs/reference/screen.mdx:757: shorten to what a user needs, for example "On the web engine, a checkbox or radio hidden under its own label (as in Element Plus) is clicked through that label. Anything else covering it still fails ACTION_FAILED." The changeset can be shortened the same way.

For the maintainer

From here on, check/tap succeed in cases where Playwright's check() fails. Playwright's expectHitTarget only accepts the target or its descendants and never falls back to a label (page.locator('label').check() works there because retarget('follow-label') reads the state through the label). Is this intended Playwright-parity drift for the web engine?

This was an automated review.

samanyudas and others added 3 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>
@samanyudas
samanyudas force-pushed the fix/web-check-through-label branch from f74e0e3 to dc700e8 Compare October 26, 2026 01:23
@samanyudas

Copy link
Copy Markdown
Contributor Author

[claude-opus-5-5] responding on behalf of samanyudas

@okwasniewski thanks, all five are addressed in dc700e8 (rebased on main).

  1. Decided once. The choice no longer depends on what is on top. pickStandIn walks elementsFromPoint at the input's centre and takes the topmost element that is the input or inside one of its labels, past anything else (a v-loading mask, a modal). So the label is chosen while the mask is still up, and Playwright's checks on the label wait it out, or fail on it: the modal tests still end NOT_ACTIONABLE with <div class="modal"> intercepts pointer events. The only undecidable state is nothing of the control rendered (a display:none or visibility:hidden dialog not open yet). The page throws for that one, and clickControl reads again through pollCondition under the action's deadline, with no fixed delay and no retry count. If it never renders it fails NOT_ACTIONABLE: tap did not become actionable in time: the control and its labels are not visible. New tests cover both of your repros (mask removed after 300ms, and a display:none or visibility:hidden container shown after 300ms) for check and tap, on all three shapes and both target kinds. All 14 were red on f74e0e3.
  2. Resolved twice. One evaluateHandle returns the label. The index, StandIn, labelAt, and the null-label branch are gone. The click point comes from label.control on that same handle.
  3. Centre outside the label box. Now returns null, so the input is clicked as before. A test pins that it stays NOT_ACTIONABLE and unchecked.
  4. Scroll before the guards. A tap on anything that is not an enabled, labelled checkbox or radio returns before scrollIntoView.
  5. Docs and changeset. Both use your wording.

Built CLI, scratch project with the real theme-chalk CSS, the three original tests plus each one behind a mask shown for 800ms and in a display:none container shown after 800ms:

main f74e0e3 dc700e8
Tests 9 failed | 0 passed (9) Tests 2 failed | 7 passed (9), the mask cases: <span class="el-radio-button__inner">安装</span> intercepts pointer events Tests 9 passed (9), 7.51s

Through the CLI, the dialog case already passed on f74e0e3, because the role locator resolves only once the dialog is shown. The engine-level tests reproduce it with raw locators and element handles. Web suite: Tests 640 passed | 1 skipped (641). pnpm check is green.

On Playwright parity: yes, this is drift. check and tap now succeed where Playwright's check() refuses the input itself, but only by clicking that input's own label, which is what a user's click does. Whether the web engine should do that is your call, so I have left the question open for you.

@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 4 files (changes from recent commits).

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

Comment thread packages/web/src/actions.ts Resolved
Comment thread packages/web/src/actions.ts Resolved
…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>
@okwasniewski

Copy link
Copy Markdown
Member

Thanks @samanyudas. I re-checked at 0c51c84:

  1. Choice decided before the wait: done. pickStandIn now picks the control's own label from elementsFromPoint, so a mask on top no longer changes the choice. An unrendered control is polled within the deadline. Your mask and display:none/visibility:hidden dialog tests pass.
  2. Label resolved twice: done. One evaluateHandle returns the label. The index, StandIn and labelAt are gone.
  3. Centre outside the label box: done. It returns null, and a test covers it.
  4. Scroll before the guards: done.
  5. Docs and changeset: done.

pnpm check passes and check-actions.test.ts passes (75/75, 3 more runs under CPU load also green). With src/actions.ts reverted to main, 35 cases fail, so the tests do their job. I also checked a locator target whose form re-renders while the mask is up. The pinned label goes stale and the engine returns a retryable NODE_STALE, which the runner re-resolves, so that case is fine.

Nits

  • check-actions.test.ts: each "still refuses" case waits out the 2s deadline twice (check, then tap). That is about 80s of the file's 100s. Let perform take a timeout and pass something like 500ms for the refusal cases.
  • actions.ts:171: let label = null as ElementHandle<HTMLLabelElement> | null needs a cast and a comment to get past narrowing. Typing it as ElementHandle<HTMLLabelElement> | undefined and checking === undefined, or returning the handle from a small helper, would drop both.

For the maintainer

This was an automated review.

samanyudas and others added 2 commits October 27, 2026 21:46
… 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>
@samanyudas

Copy link
Copy Markdown
Contributor Author

Thanks, both fixed. perform now takes a timeout, so the "still refuses" cases use 500ms and check-actions.test.ts drops from about 102s to 48s. The null as cast is gone too.

@okwasniewski

Copy link
Copy Markdown
Member

Thanks @samanyudas. Re-checked 2e0883d: both nits are done.

  1. perform takes a timeout and the refusal cases use 500ms.
  2. label is typed ElementHandle<HTMLLabelElement> | undefined, so the cast and its comment are gone.

CI is green. Nothing left from my side. The Playwright parity question from the last review is still open for the maintainer.

This was an automated review.

@okwasniewski
okwasniewski dismissed their stale review October 27, 2026 22:00

Addressed, PR re-checked and labeled Ready. Automated review.

@github-actions github-actions Bot added size:L Up to 499 changed lines, not counting tests, fixtures, or the lockfile and removed Ready for Human Review labels Oct 28, 2026
@okwasniewski

Copy link
Copy Markdown
Member

Re-checked at 15e04fa. This only merges main and needed no conflict resolution. The overlapping change on main, #958 uploadFiles in actions.ts, is a separate function and doesn't touch the label stand-in path. CI is green. Relabeling Ready for Human Review.

This was an automated review.

@okwasniewski

Copy link
Copy Markdown
Member

Automated review by Claude Code on behalf of maintainers.

This now conflicts with main in packages/web/src/actions.ts. Two changes landed there: #1552 (d2556bc) made isChecked throw on the wrong element and made uncheck click ARIA radios, and #1571 (4c44e44) builds element handles lazily for observed nodes. Please rebase onto main. Then check that the label-click path still gets a handle under #1571, and that check-actions.test.ts still passes with #1552's checked-state rules.

samanyudas and others added 2 commits November 6, 2026 22:26
…-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>
@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of samanyudas

Merged main into the branch (8dc0761) and resolved the packages/web/src/actions.ts conflict. I merged instead of rebasing because the branch already had main merges, and the PR squashes anyway.

Verified locally on the merged tree:

@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

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>

@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 2 files (changes from recent commits).

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

View guided diff | Re-trigger cubic

Comment thread .changeset/check-through-label.md Resolved
@okwasniewski

Copy link
Copy Markdown
Member

Automated review by Claude Code on behalf of maintainers.

Re-checked at e05a6f19.

Merge with main

Ran

  • Build, typecheck and oxlint: clean.
  • check-actions.test.ts: 79/79 pass.
  • Full @e2e-dev/web suite: 775 pass, 1 skipped.
  • 3 of 4 mutations on the conflict-resolved lines are caught.
  • By hand: uncheck through the label on an Element Plus checkbox works. On an Element Plus radio it is refused.

Optional

  • No test fails if setChecked clicks target instead of the pinned element (actions.ts:65). Swapping the element between the state read and the click would pin it.
  • The changeset says uncheck works through a label, but no committed test covers it.
  • pickStandIn needs the label to have a box, so a display:contents label never qualifies. That only matters once fix(web): list a checkbox or radio its own label draws over no box #1595 lists such controls. I raised it there.

Relabeling Ready for Human Review. The Playwright parity question is still open for the maintainer.

This was an automated review.

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>
@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of samanyudas

Both optional test gaps are covered in ec2c689. It is a test-only change.

  • Pinned element. A new case passes a locator that matches a different checkbox after setChecked resolves its handle. The case expects the checkbox it read to be checked. If clickControl gets target instead of element (actions.ts:65), the case fails.
  • uncheck through a label. A new case, on both target kinds, unchecks an Element Plus checkbox through its label. It also checks that an Element Plus radio is refused with no click. If pickStandIn always returns null, both kinds fail.

Ran: pnpm check exit 0. check-actions.test.ts passed 82 of 82. The @e2e-dev/web suite passed 778 tests with 1 skipped.

The display: contents point is handled in #1595: the reader leaves out a checkbox under such a label, so pickStandIn never needs that label.

@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

@okwasniewski

Copy link
Copy Markdown
Member

Automated review by Claude Code on behalf of maintainers.

Re-checked at ec2c689f. Non-test diff vs main is byte-identical to e05a6f19; the main merge is clean. Both new tests are real: restoring a live-locator click at actions.ts:65 fails "clicks the control it read", and forcing pickStandIn to null fails the uncheck case. Red check is the known screenshot.e2e.ts "should work while navigating" web flake (same code passes on #1595) - rerun started. Relabeled Ready. Playwright-parity question stays with maintainers.

@kdy1

kdy1 commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Closing as already merged by merging #1595

@kdy1 kdy1 closed this Nov 11, 2026
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.

Decision executor: check/tap fails (NOT_ACTIONABLE) on Element Plus radio-button — hidden input intercepted by styled span, no fallback target

3 participants