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

Abierto
#4,093 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
html, typescript
Área
frontend, web-dev

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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!

Lenguaje dominante
TypeScript
Estrellas
8.7k
Forks
649
Merge medio
16 h 1 min
PR fusionados (30 d)
756

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de backnotprop/plannotator

Todos los issues de backnotprop/plannotator

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.