Skip to content

fix(parallax): pin container to top-left to prevent double scrollbar#2527

Merged
joshuaellis merged 1 commit into
nextfrom
fix/2255
Jun 8, 2026
Merged

fix(parallax): pin container to top-left to prevent double scrollbar#2527
joshuaellis merged 1 commit into
nextfrom
fix/2255

Conversation

@joshuaellis

Copy link
Copy Markdown
Member

Pins the Parallax container to its top-left corner so a viewport-filling parallax can no longer make the surrounding document scroll.

Background

The container is position: absolute but set no top/left, so it took its static position. When a host layout offsets that static position — notably the place-items: center in Vite's default index.css, which the reporter kept when dropping in the sandbox App — the viewport-height container was pushed below the viewport. The document then grew its own scrollbar on top of the container's overflow-y: scroll bar, which is the double/inner scrollbar from #2255.

A control measurement confirmed the overflow comes from Parallax, not the host CSS: the identical centring layout with a plain <div> produces zero document overflow, while the Parallax adds ~300px.

Fix

Add top: 0; left: 0 to the container so it anchors to its containing block regardless of static-position offsets.

Compatibility

For the documented usage (a positioned, full-height parent) this is a no-op — the static position was already top-left. The only rendering change is for a Parallax nested in a positioned ancestor that relied on static flow to sit below padding or preceding siblings; it now anchors to the ancestor's top-left. Shipped as a patch with a changeset note.

Closes #2255

The container is position:absolute with no offsets, so it inherited its
static position. Host layouts that shift it (e.g. Vite's default
place-items:center) pushed the viewport-height container past the
viewport, giving the document its own scrollbar on top of the
container's. Pin it with top/left so it stays in the viewport.

Closes #2255
@changeset-bot

changeset-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3b6a9c3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@react-spring/parallax Patch
@react-spring/animated Patch
@react-spring/core Patch
@react-spring/mock-raf Patch
@react-spring/rafz Patch
@react-spring/shared Patch
@react-spring/types Patch
@react-spring/konva Patch
@react-spring/native Patch
@react-spring/three Patch
@react-spring/web Patch
@react-spring/zdog Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
react-spring Error Error Jun 8, 2026 7:08pm

Request Review

@joshuaellis joshuaellis merged commit 822ceb0 into next Jun 8, 2026
21 of 22 checks passed
@joshuaellis joshuaellis deleted the fix/2255 branch June 8, 2026 19:14
@github-actions github-actions Bot mentioned this pull request Jun 8, 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.

Parallax has double/inner scrollbar.

1 participant