Repository navigation
fix(screenshot): draw box overlays on the image, and let the frame scale - #25
Merged
Merged
Conversation
screenshot_display placed overlays against its container, not the image. With a 1280x800 frame in the default 800x450 container the image is pillarboxed to 720x450, so a box at x=0.25 landed at x=0.083 of the picture. Box overlays also inherited the click marker's centering transform, and core.css had no .oa-overlay-box rule, so a box rendered with no border at all: invisible, and in the wrong place. - The image and its overlays now share a positioned frame that shrink-wraps the rendered image, so overlay fractions are fractions of the picture in fixed and fluid layouts. - .oa-overlay-box has a border, no transform, and a label above it. - width=None fills the parent and height=None lets the height follow the image, so a screenshot scales down on a 390 px page without a sideways scroll. - Caption, label, alt, placeholder and path are HTML-escaped. New alt argument. The documented overlay color key is applied. Tests: string checks for the markup and stylesheet, and a Chromium test that measures the box and click marker against the rendered image (letterboxed at 800x450 and fluid at 390 px). It skips when Chromium is not installed. On origin/main the browser test measures x=0.083. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
📸 Generated Screenshots PreviewScreenshots have been generated. Download the artifacts to preview them. Generated Files:
|
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
screenshot_displaydrew box overlays in the wrong place and without a border, so a box was invisible and, once you could see it, off target. This PR draws boxes on the image itself and lets a screenshot scale down to a phone-width page.The bug
Overlays were positioned against the container, not the image. The default container is 800x450, so a 1280x800 screenshot is pillarboxed to 720x450 inside it, and every overlay fraction was a fraction of the wrong box. Box overlays also inherited the click marker's
translate(-50%, -50%), andcore.csshad no.oa-overlay-boxrule at all.Measured in Chromium on
origin/main, a box atx=0.25, y=0.5, width=0.25on a 1280x800 frame:origin/main0px none2px solidThe fix
.oa-overlay-boxgets a border, no transform, and a label that sits above the box.width=Nonefills the parent andheight=Nonelets the height follow the image. With both set toNone, a screenshot scales down on a 390 px page with no sideways scroll.altargument, and the documentedcoloroverlay key is now applied.docs/COMPONENTS.mdshows the new signature.The defaults (
width=800, height=450) still produce a fixed-size container, so existing callers keep their layout.Why now
I used
PageBuilder(include_alpine=False)andscreenshot_displayto build a self-contained, step-by-step run inspector for the website: the engine's own screenshot for each step, with a box on the target the engine resolved. Every box landed off target, and at 390 px the fixed-size container overflowed the page. With this branch, the boxes land within 0.4% of the engine's region at 390 px and 1280 px. The inspector itself lives outside this repository.Tests
tests/test_components/test_screenshot.py: 9 new string checks for the markup (overlays inside the image frame, fluid mode, the pixel cap on a fixed container, escaping,color) and for the stylesheet rules.tests/test_screenshot_overlay_browser.py: renders a page and measures the box and click marker against the rendered image in Chromium, letterboxed at 800x450 and fluid at 390 px. It skips when Chromium isn't installed, as on CI today. Againstorigin/mainit fails withx=0.083.How I checked it:
uv run ruff check .passes.uv run pytest tests/: 170 passed, 79 skipped (159 passed before; the 11 new tests pass, including both browser tests with Chromium installed locally).This doesn't touch the files in #24 or #23, so it merges in either order.
🤖 Generated with Claude Code