Skip to content

Commit da5261a

Browse files
sktbrdclaude
andcommitted
feat(home): let the NogglesRail globe span the full viewport on desktop
The globe and its detail panel were capped at 1152px by the layout's centred `max-w-6xl` main, leaving most of a wide screen empty on the section that is meant to read as a world map. From lg up the block now breaks out of the shell and tracks the viewport (1232px at 1280, 2512px at 2560). The section heading stays in the shell. Below lg nothing changes: the grid is single-column there and a full-width globe on a phone buys nothing. Breaking out needs `w-screen`, and `100vw` counts the scrollbar, so the block overshot the usable width by exactly one scrollbar and let the whole page be dragged 9px sideways. Fixing that took two rules that only work together: `overflow-y: auto` on html to stop the root's overflow being propagated from body to the viewport, and `overflow-x: clip` on body, which does nothing on its own while that propagation is in effect. Verified the obvious single-rule attempts first — `clip` and `hidden` on html both still scrolled 9px. `clip` and not `hidden` so body never becomes a scroll container and the sticky site header keeps working; `auto` and not `scroll` so platforms that draw a scrollbar don't get a permanent one on every page. Side effect worth knowing: this also absorbs a pre-existing ~8px mobile overflow coming from a rider card in the stake carousel. The card still overflows its row — the page just no longer scrolls sideways because of it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent be4a316 commit da5261a

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

src/app/globals.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,33 @@
118118
* {
119119
@apply border-border outline-ring/50;
120120
}
121+
/* Guard for full-bleed sections that break out of the layout's centred
122+
`max-w-6xl` main (currently the NogglesRail globe on the homepage). Those
123+
use `w-screen`, and `100vw` counts the scrollbar, so they overshoot the
124+
usable width by exactly one scrollbar and let the whole page be dragged
125+
sideways — measured at 9px before this rule.
126+
127+
These two declarations only work together, so don't split them:
128+
129+
`overflow-x: clip` on `body` alone does nothing. While `html` is `visible`,
130+
the root's overflow is propagated from `body` to the viewport and body's own
131+
used value becomes `visible` — so the clip lands on the viewport, which
132+
WebKit does not honour here (verified: `clip` AND `hidden` on `html` both
133+
still scrolled 9px). Giving `html` a non-`visible` overflow-y stops that
134+
propagation, which is what finally lets body clip its own overflow.
135+
136+
`auto`, not `scroll`: `scroll` also stops propagation but forces a permanent
137+
scrollbar on every page on platforms that draw one.
138+
139+
`clip`, never `hidden`: `clip` leaves the other axis `visible`, so body
140+
never becomes a scroll container and `position: sticky` on the site header
141+
keeps working. `hidden` would break it. */
142+
html {
143+
overflow-y: auto;
144+
}
121145
body {
122146
@apply bg-background text-foreground;
147+
overflow-x: clip;
123148
}
124149
.leaflet-container {
125150
@apply !bg-card !font-[inherit];

src/components/newhome/RailsSection.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ export function RailsSection() {
1919
);
2020

2121
return (
22-
<section id="rails" className="px-4 py-10 sm:px-6 sm:py-18">
23-
<div className={`${SHELL} flex flex-col gap-6 px-0`}>
22+
// No horizontal padding here: the heading keeps the page's shell while the
23+
// globe breaks out of it, so each one owns its own gutter.
24+
<section id="rails" className="py-10 sm:py-18">
25+
<div className={SHELL}>
2426
<SectionHeading
2527
eyebrow={t("eyebrow")}
2628
title={t("title", { rails: stats.installations, countries: stats.countries })}
@@ -33,7 +35,20 @@ export function RailsSection() {
3335
</>
3436
}
3537
/>
38+
</div>
3639

40+
{/* Full-bleed globe, desktop only.
41+
The page renders inside the layout's `max-w-6xl mx-auto` main, so the
42+
globe and its detail panel were capped at 1152px with dead space either
43+
side on a wide screen. `mx-[calc(50%-50vw)] w-screen` re-centres the
44+
block on the viewport instead of on the shell.
45+
`100vw` counts the scrollbar on platforms that reserve one, so this
46+
overshoots by half a scrollbar per side — `overflow-x: clip` on body
47+
(globals.css) absorbs it. Without that guard this is exactly the
48+
horizontal scrollbar the homepage comment warns about.
49+
Below lg it stays inside the shell: the grid is single-column there and
50+
a full-width globe on a phone buys nothing. */}
51+
<div className="mx-auto mt-6 w-full max-w-6xl px-4 sm:px-6 lg:mx-[calc(50%-50vw)] lg:w-screen lg:max-w-none lg:px-6">
3752
<RailGlobeSection />
3853
</div>
3954
</section>

0 commit comments

Comments
 (0)