Skip to content

Integrate upstream concepts: cmd/ctrl multi-select, data-* paths, draw polish, event cap, iframe selection#5

Merged
raimannma merged 6 commits into
mainfrom
merge/cleanup-cherrypicks
Jun 30, 2026
Merged

Integrate upstream concepts: cmd/ctrl multi-select, data-* paths, draw polish, event cap, iframe selection#5
raimannma merged 6 commits into
mainfrom
merge/cleanup-cherrypicks

Conversation

@raimannma

Copy link
Copy Markdown
Owner

This PR integrates the worthwhile concepts from five upstream PRs against benjitaylor/agentation. Per the project values (bundle size, surgical changes, no test deletion), most were reimplemented cleanly rather than cherry-picked, since the upstream code carried style churn, bugs, or test deletions. Each commit credits the original author.

Items handled

Upstream Concept Approach Why
benjitaylor#179 (@jameslcowan) Multi-select via single Cmd/Ctrl modifier (adds Win/Linux) Cherry-picked Code was clean and applied without conflict.
macOS Ctrl+Click context-menu guard New The cmd/ctrl multi-select relies on click; macOS fires contextmenu for Ctrl+Click. Added a capture-phase contextmenu preventDefault while the primary modifier is held. Cmd/Ctrl+Click new-tab navigation is already blocked by the existing capture-phase click preventDefault.
benjitaylor#177 (@panrafal) Include data-* attributes in element path Reimplemented Upstream diff was ~600 lines of pure style churn (stripped semicolons, double→single quotes). Reimplemented the ~15 lines of real logic: getElementPath() appends a stable data-* locator (data-testid/data-test/data-cy/data-qa/data-component, else first meaningful data-*), filtering framework-internal attrs (data-reactid, data-v-*, etc.).
benjitaylor#114 (@stevysmith) Polish drawing UX Reimplemented (partial) Dropped the stale circle-detection hunk (the stroke classifier was rewritten upstream). Kept the genuine fixes: Escape in draw mode now closes an open popup while staying in draw mode, and the draw canvas shows a pencil cursor.
benjitaylor#98 (@bianbiandashen) Event cleanup for memory store Reimplemented Upstream had a fatal bug: the new addEvent() called itself recursively (stack overflow). Reimplemented minimally: push then trim the events array to a fixed cap. Dropped the periodic timer and the three new env-var knobs.
benjitaylor#81 (@liuxiaopai-ai) Element selection inside same-origin iframes (issue benjitaylor#71) Reimplemented Upstream deleted ~127 lines of valuable existing tests. Reimplemented the iframe traversal in deepElementFromPoint, the drag-select scan, and the marker re-resolve path (recursive, nested frames, cross-origin skipped, child rects mapped to viewport coords). Kept all existing tests and added new ones. Also fixed a cross-realm bug present in the original — iframe elements failed instanceof HTMLElement against the top realm and were silently dropped; added a realm-aware isHTMLElement check.

Build / test

  • pnpm build (package, via tsup): success
  • pnpm --filter agentation test: 100 passed (existing suite preserved; added 5 iframe-helper tests + 5 data-attr path tests)
  • mcp tsc --noEmit: clean

Rebased onto current main.

🤖 Generated with Claude Code

jameslcowan and others added 6 commits June 30, 2026 15:04
The cmd/ctrl multi-select (benjitaylor#179) relies on click
events, but macOS fires a contextmenu event for Ctrl+Click. Prevent its
default while the primary modifier is held so the OS menu doesn't pop
mid-selection.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
getElementPath() now appends a stable data-* locator (data-testid,
data-test, data-cy, data-qa, data-component, then the first meaningful
non-framework data-* attribute) to each segment, giving agents more
robust selectors. Framework-internal attrs (data-reactid, data-v-*, etc.)
are filtered out.

Reimplements the concept from benjitaylor#177 by @panrafal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Escape in draw mode now closes an open annotation/edit popup while staying
in draw mode (previously it exited draw mode entirely). The draw canvas
also shows a pencil cursor, switching to a pointer when hovering a stroke.

Drops the stale circle-detection tweak from the upstream PR (the stroke
classifier was rewritten since). Reimplements the remaining concepts from
benjitaylor#114 by @stevysmith.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The memory store's events array grew without limit in long-running
processes. addEvent() now trims the oldest events once the array exceeds
a fixed cap, keeping recent events (which getEventsSince consumes) intact.

Reimplements the concept from benjitaylor#98 by @bianbiandashen,
without the recursive addEvent() bug, the periodic timer, or the extra
environment-variable knobs in the original.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
deepElementFromPoint, the drag-select element scan, and the marker
re-resolve path now traverse same-origin iframes (recursively, including
nesting), converting child-frame rects to top-level viewport coordinates.
Cross-origin frames are detected and skipped. Adds tests for the iframe
helpers; existing component/type tests are kept intact.

Fixes a cross-realm bug in the original (elements inside an iframe failed
`instanceof HTMLElement` against the top realm and were silently dropped)
via a realm-aware isHTMLElement check.

Reimplements the concept from benjitaylor#81 by @liuxiaopai-ai
(addresses issue benjitaylor#71), without deleting the existing test suite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@raimannma raimannma self-assigned this Jun 30, 2026
@raimannma raimannma merged commit 18815bc into main Jun 30, 2026
@raimannma raimannma deleted the merge/cleanup-cherrypicks branch June 30, 2026 13:06
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