Skip to content

feat: showcase scroll-into-view-transition as an alternative to smooth-scroll-into-view-if-needed - #1140

Open
stipsan wants to merge 1 commit into
mainfrom
cody/view-transition-demo-71fc
Open

stipsan wants to merge 1 commit into
mainfrom
cody/view-transition-demo-71fc

Conversation

@stipsan

@stipsan stipsan commented Nov 18, 2026

Copy link
Copy Markdown
Member

Adds a "Smooth scrolling with View Transitions" section right after the existing "Scrolling if needed" demo. It presents scroll-into-view-transition as the alternative to smooth-scroll-into-view-if-needed. The smooth-scroll demo and the hero are unchanged.

View Transitions demo beside the smooth-scroll demo

What the demo shows

  • It uses the same A–G list and C / D / F buttons as the smooth-scroll demo, with Easing (Default, Ease in out, Overshoot) and Scroll mode (If needed, Always) selects.
  • The snippet is highlighted at build time like the others. It shows await scrollIntoView(node, { duration, easing, middleware }). With "If needed", the snippet adds onlyIfNeeded() from scroll-into-view-transition/middleware.
  • The copy explains that the package takes the scroll-into-view-if-needed options, including middleware, and returns a Promise. CSS View Transitions run the animation. When View Transitions aren't supported, or the user prefers reduced motion, it scrolls instantly. In that case the demo shows a short "Scrolling instantly: …" note.
  • I added one sentence to the "Minimal" intro column pointing to the package, and added a matching case to the legacy Cypress spec.

Dependency: git branch plus a patch (please review)

The package isn't on npm. It's installed from the branch of scroll-into-view-transition#14, and the lockfile pins head bf3607db5f9096c8e76aba18e535831d682528f8.

On its own, that install ships no code. The package builds dist/ only in prepublishOnly, and pnpm only runs prepare for git dependencies. src/ isn't in its files either. To keep the install on the git branch, patches/scroll-into-view-transition@0.1.2.patch adds the dist/ built from bf3607d with vp pack. It's about 380 lines of unminified ESM and .d.mts, registered under patchedDependencies.

To remove the patch, the package needs either a prepare build script or an npm release. Once it has one, delete the patch and the patchedDependencies entry.

Checks

These pass locally: vp check, vp exec knip, vp run typecheck (0 errors), vp run build, and vp migrate with no diff. vp test finds no test files, the same as on main.

I tested it in Chrome: the scrolling animates, the snippet changes with each option, no fallback note shows, and the existing smooth-scroll demo still works.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Installs scroll-into-view-transition from the git branch of
scroll-into-view/scroll-into-view-transition#14 (bf3607d). The package only
builds in prepublishOnly, which git installs don't run, so a pnpm patch adds
its built dist/.

Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
@vercel

vercel Bot commented Nov 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scroll-into-view-dev Ready Ready Preview Nov 18, 2026 12:25pm UTC

Request Review

@stipsan
stipsan marked this pull request as ready for review November 19, 2026 14:49

This branch was successfully deployed

1 active deployment
Preview — 164fe38d Deployed Nov 18, 2026 by vercel[bot]
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.

2 participants