Skip to content

Fix stale element hit-testing cache causing selection to feel stuck#286

Draft
aidenybai wants to merge 2 commits intomainfrom
cursor/fix-selection-stuck-db9a
Draft

Fix stale element hit-testing cache causing selection to feel stuck#286
aidenybai wants to merge 2 commits intomainfrom
cursor/fix-selection-stuck-db9a

Conversation

@aidenybai
Copy link
Copy Markdown
Owner

@aidenybai aidenybai commented Apr 8, 2026

What

Fixes hover/selection box not appearing in activation mode on pages that block pointermove events in the bubbling phase.

Why

Some sites attach pointermove listeners that call stopImmediatePropagation() (bubble). Our pointermove listener was registered without capture, so handlePointerMove never ran → detectedElement stayed null → selection box never appeared.

How

  • Register the pointermove listener in capture phase (capture: true).
  • Add a Playwright regression test that installs a bubbling-phase pointermove blocker and asserts the selection box still appears.

Tests

  • pnpm --filter react-grab test
  • pnpm test
Open in Web Open in Cursor 

Summary by cubic

Fix hit-testing cache returning stale elements and restore hover selection when pages block pointermove. getElementAtPosition now reuses cache only when the pointer is close and within the throttle window, and we listen to pointermove in capture phase to avoid bubbling blocks.

Written for commit 9675cc2. Summary will update on new commits.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gym Ready Ready Preview, Comment Apr 9, 2026 1:23am
react-grab-website Ready Ready Preview, Comment Apr 9, 2026 1:23am

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 8, 2026

Open in StackBlitz

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/cli@286
npm i https://pkg.pr.new/aidenybai/react-grab/grab@286
npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/mcp@286
npm i https://pkg.pr.new/aidenybai/react-grab@286

commit: 9675cc2

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
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.

2 participants