Skip to content

feat(carousel): count the slides in view, page with Home and End, and peek at the next slide on narrow pages - #476

Merged
vite-hub[bot] merged 4 commits into
mainfrom
feat/carousel-range-keys-peek
Nov 21, 2026
Merged

vite-hub[bot] merged 4 commits into
mainfrom
feat/carousel-range-keys-peek

Conversation

@onmax

@onmax onmax commented Nov 20, 2026

Copy link
Copy Markdown
Owner

With columns=2 and 3 slides, one click on Next takes the counter from 1 / 3 straight to 3 / 3. The end of the track counts as the last slide, so slide 2 never appears in the counter even though it stays on screen. On a phone, each slide fills the column, and only the counter hints that there are more.

This PR borrows three ideas from AeroSlider, which also uses native scroll and CSS snap:

  • The counter names every slide in view: 1–3 / 5 → 2–4 / 5 → 3–5 / 5. It works out how many slides fit from the track's width, not from what's on screen, so it doesn't flicker mid-scroll. With one slide per view it reads 2 / 5 as before.
  • Home and End go to the first and last slide, with the same guards as the arrow keys (modifiers, form fields, sideways-scrolling code).
  • On a narrow page the next slide peeks in. Each slide is --cc-peek (default 3rem) narrower than the column, so about 2rem of the next one shows past the gap. A carousel with one slide still fills the column, and --cc-peek: 0px turns the peek off. Annotate's ::compare gets it too, when its two screenshots show one at a time.

There's no markup change, so the Vue, React and Svelte renderers pick this up through the shared script and CSS.

I compared the options on a prototype with the real carousel CSS: counter as range vs stops, phone full width vs peek, and two thumbnail styles. I left thumbnails out: the zoomed view already has a thumbnail strip, and adding one to the carousel means new markup in all four renderers.

e2e/carousel.e2e.ts replaces the "end counts as the last slide" test with the range counter and adds tests for the peek width and for Home/End. Those three fail on main. The carousel, annotate and zoom e2e suites pass (59 tests), and so do the carousel and annotate unit tests. I haven't run the full pnpm ready. CI does.

@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-20T15:36:58.499558Z
We couldn’t complete this review. Comment @codex review to try again.
a9ddefa 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

Fix the visible range calculation and backward paging after End before merging. Both failures reproduce in Chromium outside the new test cases.

Approach: Keeping native scroll snapping and sharing the changes across renderers is sound, but the counter and keyboard handling need to agree with where the track can actually stop.

Reviewed changes across all six files, including annotate’s use of the shared carousel. All 59 Chromium e2e tests and 99 unit tests passed, with one unit test skipped; the inline findings come from additional browser checks.

  • Visible range: Checked the live counter at wide and narrow widths, including percentage gaps and custom peeks.
  • Keyboard navigation: Checked Home/End, reversal at the last snap position, and native page scrolling when all slides fit.
  • Responsive peek: Checked the narrow track layout and backward paging, and reviewed the updated accessibility and theming docs.

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

Comment thread packages/carousel/src/client.ts Resolved
Comment thread packages/carousel/src/client.ts Resolved
Comment thread packages/carousel/src/client.ts Resolved
Comment thread packages/carousel/src/styles.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@476

comark-badge

pnpm add https://pkg.pr.new/comark-badge@476

comark-bundle

pnpm add https://pkg.pr.new/comark-bundle@476

comark-cards

pnpm add https://pkg.pr.new/comark-cards@476

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@476

comark-cast

pnpm add https://pkg.pr.new/comark-cast@476

comark-charts

pnpm add https://pkg.pr.new/comark-charts@476

comark-chat

pnpm add https://pkg.pr.new/comark-chat@476

comark-chips

pnpm add https://pkg.pr.new/comark-chips@476

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@476

comark-code

pnpm add https://pkg.pr.new/comark-code@476

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@476

comark-colors

pnpm add https://pkg.pr.new/comark-colors@476

comark-comments

pnpm add https://pkg.pr.new/comark-comments@476

comark-critic

pnpm add https://pkg.pr.new/comark-critic@476

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@476

comark-details

pnpm add https://pkg.pr.new/comark-details@476

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@476

comark-diff

pnpm add https://pkg.pr.new/comark-diff@476

comark-embed

pnpm add https://pkg.pr.new/comark-embed@476

comark-fields

pnpm add https://pkg.pr.new/comark-fields@476

comark-figure

pnpm add https://pkg.pr.new/comark-figure@476

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@476

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@476

comark-git-graph

pnpm add https://pkg.pr.new/comark-git-graph@476

comark-github

pnpm add https://pkg.pr.new/comark-github@476

comark-icon

pnpm add https://pkg.pr.new/comark-icon@476

comark-include

pnpm add https://pkg.pr.new/comark-include@476

comark-keys

pnpm add https://pkg.pr.new/comark-keys@476

comark-links

pnpm add https://pkg.pr.new/comark-links@476

comark-linter

pnpm add https://pkg.pr.new/comark-linter@476

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@476

comark-mark

pnpm add https://pkg.pr.new/comark-mark@476

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@476

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@476

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@476

comark-media

pnpm add https://pkg.pr.new/comark-media@476

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@476

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@476

comark-motion

pnpm add https://pkg.pr.new/comark-motion@476

comark-outline

pnpm add https://pkg.pr.new/comark-outline@476

comark-properties

pnpm add https://pkg.pr.new/comark-properties@476

comark-qr

pnpm add https://pkg.pr.new/comark-qr@476

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@476

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@476

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@476

comark-sources

pnpm add https://pkg.pr.new/comark-sources@476

comark-steps

pnpm add https://pkg.pr.new/comark-steps@476

comark-table

pnpm add https://pkg.pr.new/comark-table@476

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@476

comark-tests

pnpm add https://pkg.pr.new/comark-tests@476

comark-time

pnpm add https://pkg.pr.new/comark-time@476

comark-ui

pnpm add https://pkg.pr.new/comark-ui@476

comark-xref

pnpm add https://pkg.pr.new/comark-xref@476

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@476

commit: 320c834

@vite-hub

vite-hub Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Waiting 2026-11-21T02:17:45.516Z 1m 53s
View session Completed 2026-11-21T02:02:38.429Z 4m 59s
View session Cancelled 2026-11-21T01:39:53.105Z 6m 49s
View session Cancelled 2026-11-20T15:52:09.672Z 16m 31s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

View session

PR #476 is ready to merge. All hosted checks passed, every review thread is resolved, and no actionable findings remain. The 18 carousel unit tests and repository lint passed using the installed binaries after pnpm’s preflight failed to open its local SQLite database. No new commit was needed.

View session

Pushed 320c834 to fix the P1 padded-track paging bug and resolved the review thread. Paging now measures stops from the scrollport, with regression tests for narrow LTR and RTL tracks and wide padded tracks. Geometry checks, 102 unit tests, and lint passed. Local browser setup failed, and sandbox restrictions blocked two Annotate CLI tests. Hosted CI is pending.

Session

Pull request evidence changed.

Session

Pull request evidence changed.

Session

Pull request evidence changed.

@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 paging logic skips a reachable range in a scaled carousel and can jump past the last full range when slide content overflows.

Approach: Keep native scroll snap, but derive the paging stops from the slide panels rather than from a mismeasured column count or the raw scroll limit.

Reviewed changes in 85e945f since the prior review. All 64 targeted Chromium e2e tests and all five new Firefox regression tests passed; the inline findings come from additional browser checks.

  • Measured full slides from rendered pitch instead of parsing the computed gap.
  • Mapped paging targets to reachable slide starts and cleared pending smooth-scroll targets on no-op requests.
  • Restored native keyboard behavior on tracks without overflow and added regression coverage for the original findings.

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

Comment thread packages/carousel/src/client.ts Resolved
Comment thread packages/carousel/src/client.ts Resolved

@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

A themed track with inline padding can announce the final page and disable Next while that page is still offscreen.

Approach: Deriving the stops from the panel geometry keeps paging independent of overflowing content, but the stop positions need to use the track’s scroll origin.

Reviewed changes in c5f4d6d since the previous review. All 67 targeted Chromium end-to-end tests and 103 unit tests passed (one skipped). Additional checks in Chromium and Firefox reproduced the inline finding.

  • Unified paging geometry. Converted rendered panel distances into scroll coordinates and shared the resulting stops across paging, the counter, and the arrow states.
  • Aligned the final narrow snap. Snapped the last panel by its end edge and let the browser handle keys when the carousel cannot page.
  • Added regression coverage. Tested paging under transform: scale() and CSS zoom, and verified that wide slide content does not extend the last page.

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

Comment thread packages/carousel/src/client.ts Resolved

@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.

✅ No new issues found. No P0 or P1 findings remain.

Reviewed changes in 320c834 since the prior review. The workspace build, 70 Chromium end-to-end tests, and all three new Firefox regression tests passed. The full Firefox carousel suite had two failures involving focus and scrollbar behavior; both also reproduce with the prior runtime.

  • Measured paging stops from the scrollport. Verified that padded tracks reach every slide or full range in both directions and that the counter matches the slides in view.
  • Disabled Previous at the first reachable stop. Verified that returning home disables Previous even when leading padding puts the first stop past scroll offset zero.
  • Added regression tests. Covered narrow padded tracks in LTR and RTL and verified that a wide track with leading padding reaches its final full range.

Pullfrog  | View workflow run | Using gpt-6.2-sol(high) | 𝕏

@vite-hub
vite-hub Bot merged commit 38aa216 into main Nov 21, 2026
7 checks passed
@vite-hub
vite-hub Bot deleted the feat/carousel-range-keys-peek branch November 21, 2026 02:22
@github-actions github-actions Bot mentioned this pull request Nov 19, 2026
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