Skip to content

fix(docsite): bound the hero's pin so overscroll works everywhere - #5431

Closed
imdreamrunner wants to merge 3 commits into
mainfrom
fix/docsite-mobile-pull-to-refresh
Closed

imdreamrunner wants to merge 3 commits into
mainfrom
fix/docsite-mobile-pull-to-refresh

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5392.

apps/docsite/src/app/globals.css turned overscroll off on the root element for the whole app:

html {
  overscroll-behavior-y: none;
}

That is also the standard way to turn pull-to-refresh off, and the rule is unscoped — so pull-to-refresh was dead on every route of the docsite, on every touch browser. It was added in #3032 to stop the home hero's position: fixed layers showing through the top/bottom overscroll gap, a bug reported on desktop; the mobile cost looks unintentional (it appears in that PR's title, summary, test plan or review nowhere).

The issue split this into a small mobile step and a hard desktop step, on the reading that the desktop hero's layers must stay fixed because their fixedness is the pin-and-cover. They don't have to. One mechanism covers both widths, so this removes the rule outright instead of scoping it.

The insight

fixed is an unbounded pin: the layer stays glued to the viewport for the entire document scroll, so at the end of the page it is still painting into the strip a bottom overscroll opens. sticky pins to the same place but is bounded by its container — it stops existing on screen once its container has gone by, and the container here is the hero band, which the showcase has covered by then. So it looks the same and cannot bleed.

The hero already had exactly this: cardsLayer is a zero-height position: sticky layer. The glow and the cards stage just bypassed it by being fixed.

Zero height is the load-bearing part. A sticky box only stays pinned for the slack between its own height and its container's, so a zero-height layer gets the whole band to travel while the visual inside it is placed absolutely. An in-flow 712px hero inside a 760px band un-pins after 48px — I tried it, and it doesn't work.

What changed

layer was now
backdropGlow (HeroThemeReel) fixed, all widths absolute inside the pin layer
stage (HeroFloatingCards) fixed absolute inside the pin layer
heroContent ((site)/page.tsx) relative / fixed ≥1024 relative / absolute ≥1024, inside a new zero-height sticky heroPin
navBackdrop fixed unchanged — a header-height strip at the very top, never in the bottom gap
globals.css overscroll-behavior-y: none deleted

cardsLayer is renamed pinLayer since it now carries the glow as well as the cards. heroPin must precede heroSpacer in the DOM: a sticky layer pins from its natural flow position, so after the spacer it would only start pinning once the whole band had already scrolled past.

Test plan

pnpm lint:strict (0 errors), pnpm build, apps/docsite vitest run (406 passed) and tsc --noEmit all green, rebased on current main. The two packages/cli failures in the root node project (component.test.mjs, hook-discovery.test.mjs, both about component-name case sensitivity) reproduce identically on a clean 8a055dfb worktree — pre-existing, unrelated.

New test — apps/docsite/src/__tests__/mobile-overscroll.test.ts, written as invariants rather than as a mirror of the code:

  • globals.css may not disable overscroll, at any width. It parses the file and reports any overscroll-behavior* declaration that isn't auto, naming its enclosing blocks.
  • none of the three hero layers may be position: fixed, in any media arm.

All four fail on the pre-fix sources and pass after.

Measured by running this branch and a pristine main worktree side by side (next dev, headless Chromium, reducedMotion: 'reduce' so the 4.5s theme reel is frozen and the arms show the same slide), pixel-diffing the home page with pixelmatch at ten scroll offsets each — 0, 200, 400, 600, 712, 760, 800, 1000, 1600, 2400.

viewport pixels differing from main overscroll-behavior-y fixed layers reaching the viewport bottom at page end
desktop 1280×900 0 at all ten offsets none → auto glow + stage → none
short desktop 1280×700 0 none → auto glow + stage + hero text → none
tablet 900×1200 0 none → auto none → none
phone 390×844 0 none → auto glow → none

So the pin-and-cover is byte-identical to what ships today, at every width, and nothing is left that can paint into the overscroll gap. The short-desktop row is why heroContent is in scope: below ~760px of viewport height it reaches the bottom edge too, so a mobile-only fix would have left a hole on any non-maximized laptop window.

Two notes for anyone reproducing locally:

  • The dev build shows a "You're viewing unreleased docs (Canary)" banner that is not on the deployed site and inflates the mobile header from 48px to 232px. It is removed before measuring; otherwise the hero geometry looks 184px off.
  • The top overscroll gap paints the white canvas (html/body are both transparent), which is the same "clean" state the issue already measured under the footer — no new exposure there.

apps/docsite/src/app/globals.css disabled overscroll on <html> app-wide to
stop the home hero's position:fixed layers showing through the top/bottom
overscroll gap (#3032). overscroll-behavior-y: none is also how you turn
pull-to-refresh off, and the rule is unscoped, so pull-to-refresh was dead on
every route of the docsite on every touch browser.

Below 1024px the hero barely pins at all: heroContent is relative, the
floating-cards stage is display:none, and the nav backdrop is a 48px strip at
the very top that never reaches the bottom gap. The one layer that did was
HeroThemeReel's backdropGlow — position:fixed, 1050px tall, block at all
widths — which spanned the viewport for the entire page scroll.

Bound the glow to heroScope below 1024px (absolute, top:0 — heroScope already
starts below the header), exactly the switch heroContent makes in page.tsx,
and scope the overscroll rule to >=1024px where the hero is genuinely pinned.

Fixes #5392
Two invariants, stated independently of how the fix is spelled: globals.css
may not disable overscroll at a width a phone can have (the file is parsed and
each declaration's enclosing media queries resolved against a 430px viewport),
and the home hero's aurora glow may not be pinned to the viewport at mobile
widths. Both fail on the pre-fix sources.
@vercel

vercel Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 24, 2026 5:32pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 24, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Aug 24, 2026
Replaces the width-split fix with one mechanism. The hero's pinned layers all
used position:fixed, which is unbounded — a fixed layer stays glued to the
viewport for the whole document scroll, so at the end of the page it is still
painting in the strip a bottom overscroll opens. That is the aurora glow
bleeding under the footer, and suppressing overscroll on <html> to hide it is
what killed pull-to-refresh site-wide (#5392).

Sticky pins identically but is bounded by its container. cardsLayer was
already a zero-height sticky layer doing exactly this; the glow and the cards
stage simply bypassed it by being fixed. So:

- the glow moves into that layer (renamed pinLayer, since it now carries both)
  and both it and the stage become absolute against it
- the hero text block gets the same treatment: a zero-height sticky heroPin,
  with heroContent absolute inside it. Zero height is load-bearing — a sticky
  box only stays pinned for the slack between its own height and its
  container's, so an in-flow 712px hero in a 760px band un-pins after 48px.
  heroPin has to precede heroSpacer: a sticky layer pins from its natural flow
  position, and after the spacer it would only start pinning once the band had
  already gone by.
- overscroll-behavior-y: none is deleted outright, at all widths

Measured against main with the theme reel frozen: zero differing pixels at
1280x900, 1280x700, 900x1200 and 390x844, at ten scroll offsets each, and no
fixed layer reaching the bottom of the viewport at page end on any of them.
This closes both steps of the issue rather than just the mobile one.

Fixes #5392
@imdreamrunner imdreamrunner changed the title fix(docsite): restore pull-to-refresh on mobile fix(docsite): bound the hero's pin so overscroll works everywhere Aug 24, 2026

@rubyycheung rubyycheung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The gradient and UI cards need to remain one visual composition and move together, matching production. This PR does not preserve that behavior on narrow screens.

Below 1024px, the visible cards come from HeroReelStack inside HeroContent in normal flow, while backdropGlow remains in the separate sticky pinLayer; the desktop HeroFloatingCards stage in that layer is hidden. As a result, the mobile gradient and the visible cards use different positioning contexts and move independently.

Please place the mobile gradient with the mobile collage—or otherwise give both the same positioning behavior—so the gradient stays attached to the UI elements while scrolling. The bounded desktop sticky approach can remain separate.

AKnassa added a commit to AKnassa/astryx that referenced this pull request Aug 27, 2026
Contain the desktop-pinned hero layers so the app-global
`overscroll-behavior-y: none` can be deleted outright instead of gated
to desktop widths: macOS trackpads get their native rubber-band back.

A `fixed` layer is not part of the document, so when the document
rubber-bands past its own edge the layer sits in the exposed gap. A
`sticky` layer lifts with the document and cannot paint past its
containing block. Each pinned layer (aurora backdrop, overlap cards,
hero text) now rides its own `absolute; inset: 0` rail, a direct child
of heroScope spanning hero band + showcase and placed ahead of the
showcase overlay, as a `position: sticky` box at >=1024px. Centering
moves from `left: 50%` + `translateX(-50%)` to auto margins inside the
full-width rail, and the 1200px box is capped to the rail's width rather
than 100vw: with a classic scrollbar 100vw is wider than the rail, which
zeroes the auto margins and shoves the box left. A rail inside the 760px
band alone would release the layer after ~48px, which is why the rails
span the showcase too.

HeroReelProvider is context-only now; its hover/focus/touch surface is
the new HeroReelSwipeArea, which page.tsx uses as the hero text's rail
so the band still pauses the reel and the mobile collage still swipes.

Also records on LayoutContent why `overflow: clip` must stay `clip`:
`hidden` or `auto` there would silently un-pin the landing page. A
source-invariant test (the docsite suite is node-only) guards the rule's
absence, the three layers never going back to `fixed`, the rails' order
and containment, and the AppShell/LayoutContent links that keep the main
area a non-scroll container.

Verified against untouched main with Playwright + pixelmatch at six
viewports x ten scroll offsets: 0 px at the default threshold, identical
layer geometry, `overscroll-behavior-y: auto` everywhere, no fixed
element reaching the viewport bottom (was 2-3), 11/11 hover/focus/swipe
checks passing on both trees, resize-while-scrolled and theme-swap
mid-scroll 0 px. Safari and a real rubber-band are not verified here.

Step 2 of meta#5392. Fixes meta#5470. Supersedes the zero-height-pin approach
in meta#5431 and folds in the backdropGlow comment correction from meta#5467.
@astracat-bot

astracat-bot Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Sep 24, 2026, 3:16 AM UTC

@kentonquatman kentonquatman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I approved, but just saw the comment from @rubyycheung. We'll need to fix that first.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks — the bounded-pin approach is the right shape: deleting the global overscroll-behavior-y: none restores pull-to-refresh on every route, and the desktop glow, cards, and hero text keep their pin-and-cover effect while bounded to the hero band.

One change is needed before this is ready:

  • On narrow screens the gradient separates from the cards. Below 1024px the visible cards are the in-flow collage in HeroContent, but backdropGlow now sits in the sticky pinLayer at all widths, so the glow stays pinned while the collage scrolls. Please put the mobile gradient with the mobile collage — for example, make the glow non-sticky/absolute below 1024px as the linked issue's mobile step describes, keeping the desktop sticky pin — so the gradient and the UI cards move together.
  • Extend the new regression test to cover that. mobile-overscroll.test.ts only forbids position: fixed, so the current narrow behaviour passes it. Add a case that fails when the narrow glow and the narrow collage use different positioning behaviour.

The branch also currently conflicts with main, which has since touched the same glow and globals.css areas — a rebase that preserves the landed narrow behaviour, plus a re-run of your cross-viewport visual matrix, will be needed before merge.

[Automated review]

@github-actions
github-actions Bot deleted the fix/docsite-mobile-pull-to-refresh branch October 1, 2026 06:25
cixzhang added a commit that referenced this pull request Nov 13, 2026
…pression (#5480)

* fix(docsite): pin the hero with sticky rails

Contain the desktop-pinned hero layers so the app-global
`overscroll-behavior-y: none` can be deleted outright instead of gated
to desktop widths: macOS trackpads get their native rubber-band back.

A `fixed` layer is not part of the document, so when the document
rubber-bands past its own edge the layer sits in the exposed gap. A
`sticky` layer lifts with the document and cannot paint past its
containing block. Each pinned layer (aurora backdrop, overlap cards,
hero text) now rides its own `absolute; inset: 0` rail, a direct child
of heroScope spanning hero band + showcase and placed ahead of the
showcase overlay, as a `position: sticky` box at >=1024px. Centering
moves from `left: 50%` + `translateX(-50%)` to auto margins inside the
full-width rail, and the 1200px box is capped to the rail's width rather
than 100vw: with a classic scrollbar 100vw is wider than the rail, which
zeroes the auto margins and shoves the box left. A rail inside the 760px
band alone would release the layer after ~48px, which is why the rails
span the showcase too.

HeroReelProvider is context-only now; its hover/focus/touch surface is
the new HeroReelSwipeArea, which page.tsx uses as the hero text's rail
so the band still pauses the reel and the mobile collage still swipes.

Also records on LayoutContent why `overflow: clip` must stay `clip`:
`hidden` or `auto` there would silently un-pin the landing page. A
source-invariant test (the docsite suite is node-only) guards the rule's
absence, the three layers never going back to `fixed`, the rails' order
and containment, and the AppShell/LayoutContent links that keep the main
area a non-scroll container.

Verified against untouched main with Playwright + pixelmatch at six
viewports x ten scroll offsets: 0 px at the default threshold, identical
layer geometry, `overscroll-behavior-y: auto` everywhere, no fixed
element reaching the viewport bottom (was 2-3), 11/11 hover/focus/swipe
checks passing on both trees, resize-while-scrolled and theme-swap
mid-scroll 0 px. Safari and a real rubber-band are not verified here.

Step 2 of #5392. Fixes #5470. Supersedes the zero-height-pin approach
in #5431 and folds in the backdropGlow comment correction from #5467.

* docs(docsite): keep the overflow: clip note on the hero rail, not in core

Review: the comment-only change to packages/core/src/Layout/LayoutContent.tsx made a docsite fix look like a core change and pulled in the core CI path. The note on why AppShell's main area must stay overflow: clip now lives on the rail style in HeroThemeReel.tsx; home-hero-overscroll.test.ts still enforces it in LayoutContent.

* test(docsite): narrow the overscroll guard to page-wide selectors

Review: the guard rejected every non-auto overscroll-behavior declaration in globals.css, which would also reject a legitimate contain on a nested scroller. It now reports a declaration only when its selector subject is html, body, :root or * (case-insensitive, :is() and :where() looked through, enclosing at-rules named), and only real declarations, so an @supports (overscroll-behavior: none) prelude cannot swallow the rule inside it. The guard has its own fixtures; the page-level rule this change deletes still fails it inside any at-rule.

* test(docsite): classify the overscroll guard's selector subject precisely

Review (astracat-bot): isPageWide flagged any trailing `*` and only
unwrapped :is()/:where() when the wrapper was the whole subject, so it
both rejected legitimate nested rules and missed composed root rules.
Test-only; no change to the sticky hero runtime.

F1: a trailing `*` now counts as page-wide only on its own or as a child
or descendant of a first compound that can be the root (html, :root or
*, bare or wrapped): `*`, `*:hover`, `html *`, `:root > *`, `* > *` stay
reported; `.dialog *`, `body .dialog *`, `.sheet > *` and `.dialog * *`
with `contain` pass. Red before the change: those four were reported as
offenders.

F2: the splitter now keeps (), [] and quoted strings whole, and the
subject compound is split into simple selectors, so html, body or :root
counts anywhere in it and :is()/:where() are looked through wherever
they sit; :not()/:has() arguments are not. `:is(html, body).mode`,
`:is(html, body):hover`, `:where(html)[data-hero-dark]`,
`[data-x]:where(html)`, `html[class~='dark']` and
`body[data-mode='a b']` are now reported. Red before the change: the
guard returned [] for all six.

home-hero-overscroll.test.ts: 20/20 (16 existing, 4 new), including the
real globals.css assertion.

* test(docsite): report a * that reaches body after head in the overscroll guard

Review (astracat-bot), F1 follow-up: 16d7e27 counted a `*` subject only
on its own or under a root-capable first compound via ` ` or `>`, so it
silently allowed sibling selectors that land on body, which always follows
head: `* + *`, `* ~ *`, `head + *`, `head ~ *`, `:root > * + *`,
`html > head ~ *`. eef4fd2 reported all of them.

The `*` subject is now walked through a model of the page's top (html
holds head, then body): each compound must name the element it lands on
(its tag, `:root` for html, or `*`, bare or inside :is()/:where()), and
` `/`>` step to the parent while `+`/`~` step to the previous sibling.
So `* + *`, `head + *` and `:root > * + *` are reported; `html ~ *` and
`html + *` (html has no siblings) and nested owl selectors like
`.stack > * + *` are not. canBeRoot is folded into the same walk.

Red before the change, on the new fixtures: `expected [ …(5) ] to deeply
equal [ …(9) ]`, missing `* + *`, `* ~ *`, `head + *` and `:root > * + *`.
home-hero-overscroll.test.ts: 21/21 after, including the real globals.css
assertion. F2's fixtures are unchanged and still pass. Test-only.

* Merge branch 'main' into rocky/issue-5470-hero-sticky-rails

* Merge main into rocky/issue-5470-hero-sticky-rails

Main moved the homepage's client content from page.tsx into HomePage.tsx
(the server page now renders HomePage with build-time previews). The hero
rail and sticky changes this pull request made in page.tsx now apply to
HomePage.tsx, and the overscroll test reads HomePage.tsx and its named
HomePage export.

Co-authored-by: AKnassa <[email protected]>

* test(docsite): find AppShell's main region by its landmark role

AppShell on main now gives its main region a generated id, so the overscroll
guard finds that LayoutContent by role="main" instead of the old id
constant. It still fails if isScrollable stops following fill mode.

Co-authored-by: AKnassa <[email protected]>

Co-authored-by: Cindy Zhang <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — ac81082a Deployed Aug 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Docsite: pull-to-refresh is disabled on mobile by a global overscroll-behavior-y rule

3 participants