Skip to content

fix(zoom): keep the close button on a phone's screen, and zoom images in an app's own carousel - #462

Open
onmax wants to merge 2 commits into
mainfrom
fix/zoom-caption-and-carousel
Open

onmax wants to merge 2 commits into
mainfrom
fix/zoom-caption-and-carousel

Conversation

@onmax

@onmax onmax commented Nov 18, 2026

Copy link
Copy Markdown
Owner

On a 390px phone, zooming an image with a long alt text pushes the close button off screen. The zoomed view's grid sets rows but no column, so its column grows to the caption, which stays on one line. On a 390px screen the close button sat at 666px. This PR gives the dialog grid-template-columns: minmax(0, 1fr), so the caption ends in an ellipsis. The [data-aside] layouts keep their own columns.

Images inside an app's own ::carousel don't zoom either. The parse plugin leaves alone the images inside any carousel, slide, screenshot or compare block, because comark-carousel and comark-annotate zoom those as a whole. I hit this on a site whose own carousel component holds booking screenshots. This PR skips those blocks only when state.options.plugins registers the plugin that draws them. comark-carousel's slides still zoom as one, whichever of the two plugins comes first. ::zoom blocks behave as before.

Before and after at 390px: https://drop.vitehub.dev/d/2bgy0z92xhqw/comark-zoom-phone-caption

Validation:

  • The new e2e test in e2e/zoom.e2e.ts fails on main (close button's right edge at 666px against 390) and passes here.
  • The new test in packages/zoom/test/zoom.test.ts fails on main, where the image in the carousel has no data-zoom, and passes here.
  • The new test in packages/carousel/test/carousel.test.ts passes on both. It keeps the slide as the only zoom target when zoom() comes before carousel(), which no test covered.
  • pnpm ready passes, apart from remark-to-comark's "no git repository" CLI test, which timed out at 5s on my loaded machine twice and doesn't touch zoom.

The dialog's grid set no column, so its implicit column grew to the one-line caption's width. On a 390px phone a long alt text pushed the close button about 280px off screen.
…rousel draws it

The plugin left the images inside any carousel, slide, screenshot or compare block alone, since comark-carousel and comark-annotate zoom those as a whole. An app with its own ::carousel component lost image zoom inside it. The plugin now skips those blocks only when state.options.plugins registers the plugin that draws them, in either order.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T09:36:50.582362Z
We couldn’t complete this review. Comment @codex review to try again.
10f7a8a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new grid keeps Close on screen, but it also makes the first thumbnails in a wide gallery unreachable by touch.

Approach: Bounding the dialog grid fixes the caption overflow at its source, and checking for the owning plugin lets app-defined carousels opt into image zoom without changing built-in slide zoom.

Reviewed changes — I checked the dialog layout and plugin interactions, including both carousel plugin orders.

  • Dialog: Bounds the default grid column to the viewport and adds a 390px regression test. The aside layouts keep their own columns.
  • Image targets: Marks images in app-defined blocks when the corresponding Comark plugin is absent; built-in carousels still zoom the whole slide. The docs and skill reference describe the distinction.
  • Verification: The three scoped packages built, and 98 unit tests and 59 Chromium tests passed. The full workspace build hit the shell limit ([timed out after 120000ms]).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-sol(high) | 𝕏

// The dialog fills the window in place of the browser's centered box. Its styles keep it shown after a close, so the
// closing animation runs to its end whatever closed it.
".cz-dialog{position:fixed;inset:0;z-index:2147483000;display:grid;grid-template-rows:auto minmax(0,1fr) auto;width:auto;height:auto;max-width:none;max-height:none;margin:0;padding:0;overflow:visible;border:0;background:none;color:var(--_comark-foreground);font:13px/1.4 var(--_comark-font);outline:none}",
".cz-dialog{position:fixed;inset:0;z-index:2147483000;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;width:auto;height:auto;max-width:none;max-height:none;margin:0;padding:0;overflow:visible;border:0;background:none;color:var(--_comark-foreground);font:13px/1.4 var(--_comark-font);outline:none}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 · Class: centered overflow clips the start of a scrollable strip. On a 390px touch viewport, open item 4 of seven grouped ::zoom blocks: the first thumbnail is entirely offscreen even at the strip’s leftmost scroll position, so tapping it is impossible. Make the strip center only when its thumbnails fit; justify-content:safe center restored direct selection in Chromium.

Technical details
# Keep the first thumbnail reachable

## Affected sites
- `packages/zoom/src/styles.ts:17` — the explicit grid column now bounds the footer to the viewport.
- `packages/zoom/src/styles.ts:60` — `.cz-strip` still centers overflowing flex items. At `scrollLeft === 0`, the first thumbnail spans x=-165px to -69px at a 390px viewport.

## Required outcome
- A reader can scroll to and tap the first and last thumbnails in a group wider than the dialog, while short strips remain centered.

Comment thread e2e/zoom.e2e.ts
await expect(page.locator(".cz-dialog")).toBeVisible();
for (const part of [".cz-stage", ".cz-header"])
expect((await rect(page, part)).right).toBeLessThanOrEqual(390);
expect((await rect(page, ".cz-close")).right).toBeLessThanOrEqual(390);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Class: long captions shrink the close button’s hit area. At 390px the caption in this test shrinks .cz-close to about 25px wide instead of 36px; longer alt text can reduce it below 24px, even though the right-edge assertion still passes. Keep .cz-close from shrinking in the header flex row and check its width as well as its position.

Technical details
# Let the caption shrink, not the close button

## Affected sites
- `packages/zoom/src/styles.ts:21–30` — `.cz-close` has a width of `2.25rem`, but the header’s flex layout can shrink it when the caption overflows.
- `e2e/zoom.e2e.ts:713` — the check constrains only the button’s right edge.

## Required outcome
- A long caption truncates without reducing the close button’s hit area. Adding `flex-shrink:0` to `.cz-close` kept it 36px wide and within the 390px viewport in Chromium.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant