Repository navigation
fix(web): check a radio or checkbox through its own label when the label covers it - #1355
samanyudas wants to merge 13 commits into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
There was a problem hiding this comment.
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
okwasniewski
left a comment
There was a problem hiding this comment.
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
-
The stand-in is decided once, before Playwright's retry loop starts.
clickControl(packages/web/src/actions.ts:160) callspickStandInonce 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 bothcheckandtap:- a full-page mask removed after 300ms (the
v-loadingpattern):NOT_ACTIONABLE ... <span class="el-radio-button__inner">安装</span> intercepts pointer events - the control inside a
display:nonecontainer shown after 300ms (dialog or tab opening): same error
A control rendered after 300ms passes, because
locator.evaluatewaits 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. - a full-page mask removed after 300ms (the
-
The label is resolved twice.
pickStandInreturns alabelIndex, and thenlabelAt(actions.ts:164) runs a secondevaluateHandle, 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 theStandIninterface (:96) and thestandIn === null || label === nullcheck. Return the label itself from a singleevaluateHandle, or computepositionin Node frominput.boundingBox()andlabel.boundingBox(). The index, the interface, and one branch then go away.
Nits
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. Returningnullthere is simpler and safer.actions.ts:122:pickStandInscrolls the page even when it returnsnull, 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.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 failsACTION_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.
…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>
f74e0e3 to
dc700e8
Compare
|
[claude-opus-5-5] responding on behalf of samanyudas @okwasniewski thanks, all five are addressed in dc700e8 (rebased on main).
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
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: On Playwright parity: yes, this is drift. |
There was a problem hiding this comment.
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
…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>
|
Thanks @samanyudas. I re-checked at 0c51c84:
Nits
For the maintainer
This was an automated review. |
… 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>
|
Thanks, both fixed. |
|
Thanks @samanyudas. Re-checked 2e0883d: both nits are done.
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. |
Addressed, PR re-checked and labeled Ready. Automated review.
This now conflicts with main in |
…-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>
|
Note 🤖 Claude Opus 5.5 responding on behalf of samanyudas Merged main into the branch (8dc0761) and resolved the
Verified locally on the merged tree:
|
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>
There was a problem hiding this comment.
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
Re-checked at Merge with main
Ran
Optional
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>
|
Note 🤖 Claude Opus 5.5 responding on behalf of samanyudas Both optional test gaps are covered in ec2c689. It is a test-only change.
Ran: The |
Re-checked at |
|
Closing as already merged by merging #1595 |
What and why
el-radio-button,el-radio, andel-checkboxwith 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, socheck,uncheck, andtapon the input failedNOT_ACTIONABLE(<span class="el-radio-button__inner"> intercepts pointer events,element is not visible), and an agent step on such a radio endedAUTOMATION_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 failsNOT_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 (sotapnever follows a link), or has its centre outside the label's box.evaluateHandle(pickStandIn) returns the label itself, under the action's deadline. While neither the control nor any of its labels is rendered (adisplay:noneorvisibility:hiddendialog not open yet), the page throws andclickControlreads again throughpollConditionuntil the deadline, then failsNOT_ACTIONABLE: ... the control and its labels are not visible. A tap on anything else pays that one read and keepslocator.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 failsNOT_ACTIONABLE(tap did not become actionable in time: ... waiting for locator(...)) within one timeout.setCheckedkeeps polling the input's checked state after the label click.getRootNode().elementFromPoint) and inside a frame (the frame's own viewport coordinates).Issue
Fixes #1276
Verified
Ran it locally: yes
packages/web/tests/integration/check-actions.test.ts, thea control its own label coverscases, 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 adisplay:noneorvisibility:hiddencontainer shown after 300ms (the review's repros, all 14 red on f74e0e3); a modal-covered and a disabled control that must stayNOT_ACTIONABLEand unchecked; a radio whose label covers it from outside the label's box; a boxless checkbox whose first label is hidden bydisplayor byvisibilityand 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 stayNOT_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 suiteTests 642 passed | 1 skipped (643),pnpm checkgreen.el-radio-button.css,el-radio.css,el-checkbox.css): three tests on the settled page, and each again behind av-loading-style mask removed after 800ms and in adisplay:nonecontainer shown after 800ms.node node_modules/e2e/dist/cli/bin.js run,@e2e-dev/webbuilt from main, from the previous head, and from this branch:Tests 9 failed | 0 passed (9), 180.67sTests 2 failed | 7 passed (9), 65.21sTests 9 passed (9), 7.51sACTION_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: "安装")<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.08sACTION_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.54sThrough 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
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it..d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures.e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.🤖 Generated with Claude Code