Skip to content

fix(landing): pin mobile hero stage (inset:auto was clobbering top:0)#51

Merged
acarril merged 1 commit into
mainfrom
bugfix/mobile-safari-canvas-sticky
Jun 1, 2026
Merged

fix(landing): pin mobile hero stage (inset:auto was clobbering top:0)#51
acarril merged 1 commit into
mainfrom
bugfix/mobile-safari-canvas-sticky

Conversation

@acarril

@acarril acarril commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Problem

On mobile, the hero canvas disappeared off the top of the viewport as soon as scrolling began — it never pinned. Originally suspected to be an iOS-Safari <canvas>-in-sticky compositing bug (handoff from #50), but it reproduces in Chrome device emulation too, so it is browser-independent.

Root cause

The mobile .stage rule declared offsets in the wrong order:

.stage{position:sticky; top:0; inset:auto; ...}

inset is shorthand for top/right/bottom/left, so inset:auto (added to undo the desktop inset:0) reset top back to auto. A sticky element with top:auto has no anchor edge and behaves like static — it scrolls away with the page.

Fix

One line — reorder so the offset reset comes before top:

.stage{position:sticky; inset:auto; top:0; ...}

Verification

Measured via a Chrome DevTools-Protocol harness driving real scrolling at a 393x852 / DPR-3 mobile viewport:

before after
computed top auto 0px
stage rect.top while scrolling 216 → 116 → -83 → -383 (scrolls off) 222 → 122 → 0 → 0 (pins)

Stable across 3 runs. Caveat: verified in headless Chrome emulation, not yet on a physical iPhone. The fix is deterministic per the CSS spec, so it will behave the same on iOS Safari, but on-device confirmation is still recommended before closing out the mobile work.

Docs-only change; no version bump required.

The mobile .stage rule set `top:0` then `inset:auto`; since `inset` is
shorthand for all four offsets, it reset `top` back to `auto`. A sticky
element with `top:auto` has no anchor edge, so the hero canvas never
pinned and scrolled off the top of the viewport as soon as scrolling
began. Reordering to `inset:auto; top:0` restores the intended pin.

This was browser-independent (reproduced in Chrome device emulation),
not the iOS-Safari canvas-compositing issue originally suspected.
@acarril acarril merged commit d2c30b1 into main Jun 1, 2026
8 checks passed
@acarril acarril deleted the bugfix/mobile-safari-canvas-sticky branch June 1, 2026 21:06
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