Repository navigation
fix(ui): fit a Markdown image on the screen, and a zoomed screenshot in the view - #478
Conversation
A tall image filled the whole column, over 1,000px in a 48rem one, so it covered the screen while you scrolled past. Typeset now caps an image at 70% of the window's height (40rem at most) and centers a captioned one. A click still zooms it whole. Blocks' own images, such as a screenshot's under its marks, keep their size.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
comark-annotate
comark-badge
comark-bundle
comark-cards
comark-carousel
comark-cast
comark-charts
comark-chat
comark-chips
comark-cjk
comark-code
comark-code-notes
comark-colors
comark-comments
comark-critic
comark-deflist
comark-details
comark-diagrams
comark-diff
comark-embed
comark-fields
comark-figure
comark-file-tree
comark-footnotes
comark-git-graph
comark-github
comark-icon
comark-include
comark-keys
comark-links
comark-linter
comark-magic-move
comark-mark
markdown-it-to-comark
marked-to-comark
comark-mathml
comark-media
comark-metrics
migrate-to-comark
comark-motion
comark-outline
comark-properties
comark-qr
comark-quiz
comark-reading-time
remark-to-comark
comark-sources
comark-steps
comark-table
comark-tabs
comark-tests
comark-time
comark-ui
comark-xref
comark-zoom
commit: |
Latest result Pull request merged. Final answersSession Pull request merged. PR #478 is ready to merge. The reviewed head contains the fixes for Markdown image sizing, screenshot zoom, and scroll restoration. All review threads are resolved, hosted checks passed, and no repair push was needed. Local lint exited successfully with warnings, but a pnpm SQLite error blocked the prerequisite build for focused local tests. Session Pull request evidence changed. Session Pull request evidence changed. Session Pull request evidence changed. Session Pull request evidence changed. Session Pull request evidence changed. Session Pull request evidence changed. |
There was a problem hiding this comment.
Important
The height cap works for the new test case, but it misses some ordinary Markdown images and makes measured portraits jump when zoom opens.
Approach: Shared Typeset CSS is the right place for the inline height cap, but the rule needs to preserve the image element’s aspect ratio and cover the markup Comark actually emits.
Reviewed changes — I reviewed the shared styles, the documented behavior, and the browser coverage.
- Image sizing: Caps selected Markdown images at
min(70svh, 40rem), usesobject-fit: contain, and centers captioned images. - Coverage: The build and 72 Typeset, zoom, annotate, and carousel tests passed in Chromium. Two existing zoom-motion assertions failed; their first-frame geometry reproduced without the new CSS too.
gpt-6.2-sol(high) | 𝕏
There was a problem hiding this comment.
Important
The new sizing rule fails the published CSS compatibility check, and the generated stylesheet drops the fallback for supported Safari versions that lack typed attr().
Reviewed changes — I reviewed e15dbfa, the commit since the previous Pullfrog review.
- Fitted sized Markdown images using their declared aspect ratio and added coverage before and after image load.
- Extended the cap to linked quotes and definitions, emphasized images, table cells, and unwrapped images inside the comments wrapper. The screenshot still keeps its size.
- Verified 73 Chromium browser tests and 25 UI unit tests. The compiled CSS compatibility failure reproduced locally and in CI.
gpt-6.2-sol(high) | 𝕏
There was a problem hiding this comment.
Important
The new sizing rule fixes the delayed-load layout, but it overrides a Markdown image’s authored percentage width when the image also has a height attribute.
Approach: Providing pixel dimensions as custom properties fixes the fallback without relying on typed attr(), but the width rule needs to preserve authored sizing when it can’t compute a fitted width.
Reviewed changes — I reviewed 269e7a4, the commit since the previous Pullfrog review.
- Preserved the fitted box before load by emitting dimensions as custom properties and using typed
attr()where available. - Verified both sizing paths in Chromium, including with the feature query disabled. All 74 focused browser tests and 106 unit and stylesheet checks passed.
gpt-6.2-sol(high) | 𝕏
There was a problem hiding this comment.
Important
The percentage-width fix works, but the new width cap lets fitted images claim extra column space in ordinary Markdown tables, squeezing the text beside them.
Approach: Keeping the authored width when there’s no pixel ratio is right; valid pixel ratios still need to constrain how much width the image requests from its container.
Reviewed changes — I reviewed acb69cf, the commit since the previous Pullfrog review.
- Preserved authored widths by moving the fitted width to
max-widthand adding a50%regression test alongside the delayed-load tests. - Updated dimension parsing to use the shared text helper while keeping the guard for nonnumeric dimensions.
- Verified both sizing paths in Chromium: 74 browser tests and 104 UI and stylesheet checks passed. A separate rendered Markdown probe reproduced the table regression in Chromium and Firefox.
gpt-6.2-sol(high) | 𝕏
There was a problem hiding this comment.
Important
The table layout fix works, but the new regression test fails in Chromium and Firefox before it checks the Notes column.
Reviewed changes — I reviewed 77f6343, the commit since the prior Pullfrog review.
- Restored intrinsic table sizing by giving each image a fitted pixel width while letting it shrink to its cell. The fitted and control tables now give Notes the same width, and authored
50%widths still work. - Added a browser regression test for the two layouts. Its
140pxassertion is the only failure in either browser run; 123 focused UI and stylesheet checks passed.
The two zoom and annotation commits pushed during this run are outside the reviewed range.
gpt-6.2-sol(high) | 𝕏
There was a problem hiding this comment.
Important
Zooming a block with closed details can create several screens of blank scroll, and resizing while reading a long screenshot note can skip part of the note.
Approach: Fitting the screenshot and its margin notes together is the right goal, but the bounds need to exclude hidden content and preserve the reader’s position when those bounds change.
Reviewed changes — I reviewed 422b2de and 3f1fb73 since the previous Pullfrog review.
- Measured the zoomed copy’s overflow and used it to fit and center slightly tall items and outlying notes.
- Kept stacked annotation notes inside their screenshot column on narrow layouts.
- Verified 88 passing Chromium tests across zoom, annotate, carousel, motion, and Typeset. The previously reported Typeset table-width assertion still fails. Both new findings reproduced in Chromium and Firefox.
gpt-6.2-sol(high) | 𝕏
There was a problem hiding this comment.
✅ No new issues found. No P0 or P1 findings remain.
Reviewed changes — I reviewed 1270603 since the prior Pullfrog review.
- Excluded collapsed disclosure content from zoom bounds so a closed
::detailsno longer creates blank scrolling. - Preserved reading position when resizing while scrolled into a note above a screenshot, while keeping an unscrolled view at the top.
- Corrected the Typeset table test to compare fitted images with controls without dropping the Notes column check.
The package build and 111 browser tests passed across Chromium and Firefox. The three regression cases passed in both browsers.
gpt-6.2-sol(high) | 𝕏

A tall image filled the whole column. In a 48rem column on a 1280×800 window, a portrait painting came out 768×1038, so it covered the screen while you scrolled past it.
Typeset now caps a Markdown image at
min(70svh, 40rem)and centers a captioned one over its caption. A click still zooms it whole.widthandheightset (comark-zoom measures data URIs) keeps its room and fits the picture inside withobject-fit: contain, rather than squashing it.Measured on three paintings at 1280×800 in a 48rem column:
e2e/typeset.e2e.tschecks a 2:5 image fits 70% of the window, centered at its own ratio, and a screenshot's image keeps the column's width.Zooming a screenshot
Zooming this PR's own evidence screenshot looked broken: the note above it was cut off at the left edge, and the painting ran past the bottom of the view. Two causes in comark-zoom, one in comark-annotate:
.ca-callout-westoutranked the stacked rule, so a note kept itstranslateX(-100%)and sat a whole width left, under the other column of a compare.e2e/zoom.e2e.tscovers the slightly tall item and the notes outside the box;e2e/annotate.e2e.tscovers the stacked notes. Each fails on the old code.Before/after: https://drop.vitehub.dev/d/8b6pvn5aspvd/comark-ui-image-fits-screen
🤖 Generated with Claude Code