Skip to content

fix(patchy): a look preview --compare screenshot shows only the top of each look #595

Closed

Description

@allisonmahmood

The compare page puts each look in a 100vh iframe that scrolls on its own, so a full-page screenshot (what an agent takes) shows only the first screen of each pane; the table, form, states and swatches never appear. The global skill works around it ("open it for the person, or screenshot each look alone"). A generous fixed frame height, or frames sized to their content, would make one screenshot enough.

Found while building the company look (#547). Filed by Claude Fable 5.1 (orchestrator) in Claude Code, running in T3 Code, for Allison.

Activity

  1. added
    needs-triage
    area:cli
    on Oct 7, 2026
  2. allisonmahmood commented on Oct 9, 2026

    @allisonmahmood
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: bug
    Summary: On patchy look preview <dir> --compare, size each look's frame to its specimen, so one full-page screenshot shows both whole looks.

    Current behavior:
    The two-pane previewPage(first, second) puts each look in its own <iframe srcdoc> with height: 100vh. Each specimen is about 2,200–4,900px tall, depending on the look and pane width. So each frame scrolls on its own, and a full-page screenshot (what an agent takes) is one viewport tall. At 1280×800 the screenshot is 1280×800 and shows only the masthead, headings and buttons; the cards, table, form, states and swatches never appear. The global patchy skill works around this by telling agents to screenshot each look alone.

    Desired behavior:
    On the compare page each frame is as tall as its specimen. The outer page scrolls as one, and a full-page screenshot holds both complete specimens. This stays true when the window crosses the 900px stacking breakpoint and back: frames shrink as well as grow and never get stuck at a larger height. Late font loads update the height.

    The approach both triage traces verified in Chromium:

    • Add a small inline script to the two-pane page only, allowed by a script-src 'sha256-…' entry computed from the exact script text.
    • After the page loads, read each frame's .specimen through contentDocument (the srcdoc frames are same-origin). Observe it with a ResizeObserver on its border box and set the frame's height from it. That alone handled the first fit, late fonts and window resizes.
    • Before observing, set min-height: 0; height: auto on .specimen from the script, so a look's own main { min-height: 100vh } or main { height: 100vh } can't tie the specimen to the frame height.
    • Measure the specimen, not the frame's root scrollHeight, which includes the frame's viewport and stops it shrinking.
    • Allow for the 1px divider between panes.
    • Keep height: 100vh as the CSS default, so the page without JavaScript behaves as it does today.

    Side by side, equal heights or a height per frame are both fine.

    Constraints:

    • The single-look page, including the --compare fallback when the company has no look, stays script-free and passes tier 0 validateHtml. Only the two-pane page changes.
    • Each specimen keeps its own CSP unchanged. srcdoc frames enforce both their own policy and the parent's, so specimen scripts and every remote request stay blocked, and the file still works offline.
    • The frames stay. They keep each look's :root tokens, element styles and @font-face rules from reaching the other.

    Key interfaces:

    • previewPage(first: Pane, second?: Pane): string: the signature is unchanged. Only the two-pane output changes: its CSP gains the script hash, and it gains the <script>.
    • CLI contract unchanged: same flags, the same { ok, path, failures, warnings? }, exit codes and file location. ADR-0004 needs no edit.
    • Global patchy skill, "Changing the look": replace "Its two frames scroll on their own, so open it for the person, or screenshot each look alone (…)" with guidance that a full-page screenshot shows both looks whole. Then refresh the skill's hash in skills-lock.json.
    • CLI README, look preview: say the compare frames fit their content, so one screenshot shows both looks.

    Acceptance criteria:

    • Extend the existing Chromium compare case in the tier 1 browser spec. At 1280px wide, for each frame, poll until the frame is at least as tall as the bottom of .specimen and the frame document's documentElement.scrollHeight ≤ iframe.clientHeight. Assert it again after resizing to 375px and back to 1280px, so frames shrink back rather than stick. The case fails on today's code.
    • That case keeps its existing checks: each frame shows its own look, there's no horizontal overflow, and no requests are made.
    • A look whose look.css adds main { min-height: 100vh } and main { height: 100vh } neither grows without bound nor clips, covered in the same spec.
    • The CLI test for the no-current-look --compare fallback also asserts validateHtml(page) is ok.
    • The skill text is updated and its skills-lock.json hash refreshed; the lock test passes.

    Out of scope:

    • A fixed frame height: real specimens run about 2,200–4,900px, and a valid 16px spacing token passes 6,800px.
    • CSS frame-sizing: content-height: Chrome 154+ only, and the bundled Chromium is 153.
    • Merging both looks into one document.
    • Changing the specimen's content or the single-look page.
    • Firefox and WebKit coverage: the tier 1 suite is Chromium only.
  3. added
    bug
    ready-for-agent
    size:s
    and removed
    needs-triage
    on Oct 9, 2026
  4. added a commit that references this issue on Oct 15, 2026
    aa98240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugready-for-agentsize:s

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions