Annotate (live app): allow selecting and annotating elements inside same-origin iframes of the proxied page

Aperta
#4,093 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
html, typescript
Ambito
frontend, web-dev

Direzione di ricerca

Start with the frame gate in packages/ui/components/html-viewer/bridge-script.ts and applyHtmlFramingHeaders in packages/shared/live-proxy-core.ts; trace how the bridge sends hover, selection, and rectangle events to the editor. Check how annotation targets are stored and add coverage for same-origin nested frames, including frame offsets and frame-specific selectors. Done means proxied same-site frames render and their elements can be annotated with the correct frame recorded.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi, and thanks for Plannotator. I would like to ask about annotating a local page that contains iframes.

Use case

I review designs with a "side-by-side" page: one local HTML page that places several <iframe>s next to each other, each showing a different page of the same site, or the same page at different viewport widths (for example 375 / 768 / 1280 px). I open that page with annotate (http://localhost:8080/compare.html) and want to comment on specific elements inside the individual frames ("this button is too close to the edge at 375 px").

Current behavior

  1. Only elements of the outermost page can be picked. Inside an iframe nothing can be selected; I can only mark the <iframe> as a whole or the heading around it. As far as I can tell this is by design: the bridge is injected into every HTML response but returns early in nested frames (the frame gate near the top of packages/ui/components/html-viewer/bridge-script.ts), and its comments say live-app sessions leave a page's own frames alone.
  2. If the iframes in compare.html use the proxied origin, the browser blocks them. The proxy replaces the page's CSP with frame-ancestors <editor origins> (applyHtmlFramingHeaders in packages/shared/live-proxy-core.ts), and the proxied page itself is not in that list, so a nested frame from the same proxy origin is refused and shows a broken-page icon.
  3. Pointing the iframes at the original port (http://localhost:8080/...) avoids the block, but then the frame content is cross-origin to the proxied outer page, so no annotation script can reach into it.

Minimal repro:

  1. Create index.html, a.html and compare.html in a folder. compare.html contains:
    <h1>Compare</h1>
    <iframe src="/index.html" width="375" height="600"></iframe>
    <iframe src="/a.html" width="768" height="600"></iframe>
    
  2. Serve it: python3 -m http.server 8080 --bind 127.0.0.1
  3. Run /plannotator-annotate http://localhost:8080/compare.html.
  4. Result: the frames are broken (blocked by frame-ancestors). If they are made to load (absolute URLs to the original port), only the whole <iframe> can be annotated, not elements inside it.

Expected behavior

For iframes that load from the same proxied site, the frames render, and elements inside them can be hovered, selected and annotated like elements of the outer page. The annotation should record which frame it belongs to.

Possible approach (just a suggestion, you know the design far better)

  • Let frame-ancestors also allow the proxied origin itself ('self' in addition to the editor origins), so same-site nesting works while other sites still cannot frame the proxy.
  • Let the bridge run in same-origin subframes of the proxied page (relax the frame gate for frames whose ancestor chain is proxy origin -> editor), and forward hover, selection and rect events to the editor with the frame's position offset.
  • Record the target as an "iframe selector + inner selector" pair (for example iframe:nth-of-type(2) >>> button.primary), which also works for nested frames.
  • Possibly opt-in (a setting or flag), since the current behavior is deliberate for apps that own their frames.

Environment

  • Plannotator version: 0.29.4 (plannotator --version)
  • OS: macOS
  • Agent: Claude Code
  • Where: Annotate (live app via local URL)

Happy to test a build or help narrow this down. Thank you!

Lingua principale
TypeScript
Stelle
8.7k
Fork
649
Merge medio
16h 1m
PR unite (30g)
756

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di backnotprop/plannotator

Tutte le issue di backnotprop/plannotator

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.