Skip to content

Let annotations pick between the elements stacked under the click - #4826

Open
shaunandrews wants to merge 1 commit into
dim-preview-around-annotated-elementfrom
add-annotation-layer-picker
Open

Let annotations pick between the elements stacked under the click#4826
shaunandrews wants to merge 1 commit into
dim-preview-around-annotated-elementfrom
add-annotation-layer-picker

Conversation

@shaunandrews

@shaunandrews shaunandrews commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code ported the layer picker from #4411 onto trunk's inspector script and wrote the test. Reviewed and tested manually in the Desktop app.

Proposed Changes

  • Clicking an element during annotation often hits a wrapper, a link, or an overlay rather than the thing you meant. The note now collects every element stacked under the click point and shows ‹ 1/N › in its header.
  • Stepping through the layers moves the outline, the scrim cut-out, and the element line in the note; the typed comment is kept.
  • Candidates come from the hit-test stack plus a bounded scan for elements behind pointer-events:none overlays, capped at 30 and ~20ms.
  • The note header now keeps the viewport size and layer controls tucked to the right regardless of selector length.

⚠️ Visual change: needs human review in light + dark mode.

Screenshots

After stepping ‹ once: the wrapping <h3> behind the link is selected, showing 2/8.

Annotation note with layer controls showing 2/8 and the wrapping heading outlined

Testing Instructions

  • Open a site preview, click Annotate, click a headline inside a section or a link inside a card.
  • The note header shows ‹ 1/N ›. Click ‹ to select the element behind; the outline and dimmed area move to it, and the <tag> line updates.
  • Type a note, switch layers, confirm the text stays.
  • npm test -- apps/ui/src/components/site-preview/inspector-script.test.ts

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.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.

1 participant