Skip to content

feat(docs): capture screenshots per viewport where the layout differs #5250

Closed

Description

@tale-code-bot

Part 2 of #4686. Triage split that issue in three; TALE-112 works part 1, the responsive delivery of the docs images.

Summary

Docs screenshots are captured at one viewport. services/platform/tests/docs-screenshots/capture.ts takes shot.viewport ?? VIEWPORT (1440×900 at DPR 2), so a phone reader sees a scaled-down desktop page even where Tale lays the page out differently on a phone.

Proposed change

  • Let a shot declare more than one viewport (phone, tablet, desktop) where the page differs. Capture each as a variant of the same shot.
  • Record the variants with their shot in services/docs/public/images/manifest.json, and keep /images/<section>/<shot>.webp as the desktop full-size file.
  • Render them with <picture> and media sources, through the shared Picture and ImageZoom of part 1. services/web/app/components/blocks/product-screenshot.tsx already does this for its phone crop.
  • Fold the capture's own WebP encoder (services/platform/tests/docs-screenshots/webp.ts and its 190 KiB quality ladder) into the shared encoder of part 1, so one implementation encodes every shot.

Acceptance criteria

  • Every shot whose layout differs by device has a phone and a desktop capture. The change lists those shots, and says why the others need none.
  • services/docs/tests/image-manifest.test.ts covers the viewport variants: each exists, is referenced, sits on the ladder and matches its file header, with no orphans.
  • A page shows the phone capture below the phone breakpoint and the desktop capture above it. The lightbox opens the matching full-size file.
  • docs/AGENTS.md, the write-docs skill and the capture README describe how to declare a viewport variant.

Activity

  1. added
    feat
    agent-ready
    on Nov 1, 2026
  2. tale-code-bot commented on Nov 1, 2026

    @tale-code-bot
    CollaboratorAuthor

    A finding from TALE-112 (part 1, branch perf/responsive-docs-images at d29f4bceb7eff80f629ce620e9ea8b2ce28911d3, not landed yet) that bears on folding the capture encoder in here.

    Part 1 encodes the docs variants with the shared policy (AVIF 80 / WebP 90 for screens, 200 KiB per variant) from the stored /images/<section>/<shot>.webp. That file is already lossy: webp.ts writes it at quality 82 or lower (effort: 6, 190 KiB ladder). Where a shot's own width is on the docs ladder (≤ 1600 px), the WebP at that rung is the original itself, and the AVIF is re-encoded from it:

    • at that native rung, the AVIF is larger than the WebP original for 22 of 33 shots: 78,094 bytes in total, at most +24.9% (platform/automation-editor-canvas-mobile, 780 px);
    • on the downscaled rungs, AVIF is 18.1% smaller than WebP over 386 pairs (12,011,651 against 14,664,114 bytes); 9 of them are larger, by 4,435 bytes in total.

    A browser that takes AVIF fetches the larger file at the native rung. Part 1 keeps AVIF everywhere, since the policy is the one the marketing site uses. When this issue folds webp.ts into @tale/ui/images/encode, encoding the original and every variant from the capture's lossless PNG in one pass removes the second lossy generation, and this overshoot with it.

    Measured with a script over services/docs/public/images/optimized/ at that head.

  3. tale-code-bot commented on Nov 2, 2026

    @tale-code-bot
    CollaboratorAuthor

    Split for TALE-330, the task that works this issue.

    TALE-330 builds the capture and the serving of phone layouts, on the feature line (branch feat/docs-viewport-screenshots):

    • a shot's phone capture (bun run docs:screenshots -- --devices phone, 390 × 844 at DPR 2, <shot>.phone.webp with "device": "phone" in the manifest);
    • its variants in bun run docs:images, through the one shared encoder;
    • DocsImage serving it below Tale's md breakpoint, and the lightbox opening its full-size file;
    • the manifest, prerender and e2e guards, and the docs for declaring one.

    It commits no phone capture: capturing needs the seeded Docker Compose stack, the platform dev server and Chromium, which the agent worker does not have. The captures themselves are #5302. It lists the 108 shots that get one and the 3 that need none, with why. It also covers the phone-step fixes, a guard that every such shot has its capture, a pinned phone branch in the markdown e2e, and the alt and caption review.

    TALE-330's commit closes this issue when it reaches the feature line; #5302 carries the rest.

  4. added a commit that references this issue on Nov 2, 2026
    0065a38
  5. added 2 commits that reference this issue on Nov 2, 2026
    9a4765e
    6ce84b1
  6. tale-code-bot commented on Nov 2, 2026

    @tale-code-bot
    CollaboratorAuthor

    Landed on release/0.6, the 0.6 feature line, with feature train #5329 as 6ce84b1 (feat(docs): capture and serve the phone layout of docs screenshots); it ships with Tale 0.6.0. GitHub closes issues only for commits on main, so the feature-train role closes this one. Board task: TALE-330.

  7. added 12 commits that reference this issue on Nov 3, 2026
    bd09dfe
    2b1748d
    53670b9
    43b6bf2
    800dacc
    3ec871c
    8fec2ca
    66158ed
    9b4a0e0
    84dcd28
    96c9819
    4a22b99
  8. added a commit that references this issue on Nov 15, 2026
    587ec50
  9. added a commit that references this issue on Nov 23, 2026
    720d4f0
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

    agent-readyfeat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions