fix(web): list a checkbox or radio its own label draws over no box
Merged
SA
8d ago+544+544+012345678901234567890123456789-10-10-01234567890123456789
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 sawboxandtext="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 (
pickStandIninpackages/web/src/actions.ts, from #1355). So a label counts only when that click can work: it has a box of its own (notdisplay: contents) and holds no link or other control besides its own.pickStandInrefuses 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'stoBeVisibledoes. - 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: contentslabel, and the label holding a link are recorded intests/crosscheck/expected.txtwith 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
e2e mcpfrom the built packages, on the Element Plus checkbox page from #1593:observe,tapthe checkbox (or the label text when no checkbox is listed),run_codeexpect(...).toBeChecked(), thencheckfalse and true.
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 mcpon a page with the Element Plus checkbox, the same box under adisplay: contentslabel, 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.tstaps 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 inisDrawnByLabel(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 labelfailed before the fix with fivechrome missinglines 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.tsfails without thehidden = falseoverride (expected true not to be true).- The web-benchmark agent suite (
--strict-cache,CI=1) has the same 7 failures ondd7d3580and on this branch. All 7 need a model call, and there was noAI_GATEWAY_API_KEYlocally.
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/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@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