Skip to content

Conversation

@liuxiaopai-ai
Copy link

Summary

Fixes #335

When using UI component libraries like Element UI, Ant Design, or Vuetify, native checkbox <input> elements are typically hidden (display: none, opacity: 0, or visibility: hidden) while a styled wrapper/label is shown instead. The check and uncheck commands directly operate on the native checkbox via Playwright's locator.check() / locator.uncheck(), which waits for the element to become visible — causing an indefinite hang.

Changes

  • Added a safeCheckAction() helper that first attempts check()/uncheck() with a 5-second timeout
  • If the action fails due to the element being hidden/not visible/timing out, it retries with { force: true } to bypass the visibility check
  • Non-visibility errors (e.g., strict mode violations) are re-thrown as before
  • Updated all 6 call sites across handleCheck, handleUncheck, handleGetByRole, handleGetByLabel, handleFilter, and handleNth
  • Added 9 unit tests covering visible elements, hidden elements (various error messages), and error propagation

How It Works

try check/uncheck with timeout: 5000ms
catch →
  if error is about visibility/hidden/timeout → retry with force: true
  else → rethrow

This ensures:

  1. Normal checkboxes work exactly as before (no behavior change)
  2. Hidden checkboxes (UI framework pattern) complete successfully via force: true
  3. Other errors propagate unchanged

@vercel
Copy link
Contributor

vercel bot commented Feb 7, 2026

@liuxiaopai-ai is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 468f2807e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +169 to +170
message.includes('Timeout') ||
message.includes('waiting for') ||

Choose a reason for hiding this comment

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

P1 Badge Restrict forced retry to explicit visibility failures

This retry condition treats any error containing Timeout or waiting for as a hidden-element case, so safeCheckAction will force a second check/uncheck even when the first failure was due to other actionability problems (for example, an overlay intercepting pointer events or a control still disabled). In those cases the forced retry bypasses normal actionability checks and can report success instead of surfacing the real blocked-state error, which changes command semantics and can mask real UI issues. Please narrow the fallback trigger to explicit visibility/hidden signals rather than generic timeout text.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: check/uncheck commands hang on hidden native checkbox elements

1 participant