feat: support grabbing text nodes - #606
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Performance report — this PR vs base branch🔴 2 regressions · 🟢 1 improvement across 77 scenarios.
A metric counts as changed only past per-metric thresholds sized to measured shared-runner variance on identical code: interaction latency ±10% and 16ms (measured in 8ms steps), frame times ±30%, long-task/LoAF sums ±10% and 500ms, memory ±25% and 512KB / 60 nodes, process CPU ±20% and 10 points, GPU-process CPU ±20% and 3 points, animation ticks ±20% and 3/s, draws/tick ±20% and 0.05, hardware GPU ±20% and 10 points, compositor production ±20% and 3fps / 5 duty-cycle points, composited layers ±20% and 2 layers / 0.5 viewport areas, rendering stages ±20% and 1ms; any ms metric with a ≥100ms baseline needs ±30%. All 73 standard scenarios (full numbers)
All 5 animation scheduling controls (full numbers)
Commit 43c0a33 · full reports in the |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ea022e6. Configure here.

Summary
Why
DOM hit testing returns elements, so text beside nested links, icons, or formatted children could only be grabbed as part of its parent element. This adds a secondary text-node hit test for mixed-content elements while retaining the parent element as the compatibility and source-resolution anchor.
Impact
Users can point React Grab at an individual direct text run without changing the public element-based API or making every text-only control behave like a text-node target.
Validation
nr buildE2E_ENVIRONMENT=vite-plus-development nr test:e2e:framework -- e2e/selection.spec.ts— 18 passednr typechecknr lintSummary by cubic
Adds precise direct text selection inside mixed-content elements in
react-grab, with per-line targeting and stable anchors. Feedback, cursors, and context now lock to text bounds through scroll, reflow, DOM replacement, brief node disconnects, and across actions.New Features
getTextNodeReferenceContextto include the selected text plus parent component/stack; works via mouse, toolbar, Enter, keyboard Context Menu, and same-origin iframes.Bug Fixes
Written for commit 43c0a33. Summary will update on new commits.
Note
Medium Risk
Touches core selection, copy, and overlay state in
core/index.tsxwith new DOM text hit-testing and relinking; behavior is heavily covered by new e2e and unit tests but regressions in edge cases (duplicated text, iframes) are still plausible.Overview
Adds precise selection of direct text runs inside elements that also have child nodes (e.g. text next to links or
<strong>), while text-only elements still behave as normal element targets.Pointer hit-testing now resolves a grabbable
Textnode under the cursor; selection boxes, labels, grabbed boxes, prompt/comment cursors, and context menus use text-line bounds (including wrapped lines) instead of the full parent box. Copy/prompt flows pass an optionaltextNodethrough the store, labels, andrunCopyFlow, withgetTextNodeReferenceContextso clipboard metadata quotes the text plus parent stack/source context.Anchoring (
text-node-anchors, normalized rect index increateTextNodeBounds) keeps the same logical line across reflow, DOM replacement, and brief disconnects; relinking is wired intorelinkLiveTargetsalongside elements.E2E gains shared activation helpers/constants, stabler edit-panel and prompt Escape tests, and a large
selection.spec.tssuite for mixed/wrapped text, scroll, shift-drag, comment mode, and DOM churn. Edit panel defers search-input focus until the dropdown mounts.Reviewed by Cursor Bugbot for commit 43c0a33. Bugbot is set up for automated code reviews on this repo. Configure here.