Skip to content

fix(mobile): sticky header, remove horizontal scrollbar, contain overflow - #181

Merged
ycagel merged 1 commit into
DigiByte-Core:masterfrom
DennisPitallano:fix/mobile-sticky-header
Aug 19, 2026
Merged

ycagel merged 1 commit into
DigiByte-Core:masterfrom
DennisPitallano:fix/mobile-sticky-header

Conversation

@DennisPitallano

Copy link
Copy Markdown
Contributor

Mobile: sticky header + no horizontal scroll

Preview (deploys from my fork): https://dg-bio.vercel.app/en-us/

The problem

On mobile viewports the site had three related layout bugs:

  1. Header did not stick. header.nav has position: sticky; top: 0, but scrolling the page caused it to slide off with the content.
  2. Horizontal rubber-band scroll. A faint horizontal scrollbar appeared at the bottom on small screens.
  3. .scroll-top "back to top" button was clipped off-screen on the right, and the "DigiByte Technical Architecture (White Paper)" ghost button overflowed the viewport.

Root cause

All three symptoms trace back to two lines in css/base.css:

html, body { height: 100%; }
body { … overflow-x: hidden; … }
  • body { overflow-x: hidden } forces overflow-y to auto on the same element (per the CSS overflow shorthand rule), which turns <body> into a scroll container. Combined with body { height: 100% }, <body> becomes a fixed-height scroll port and the sticky header sticks inside body rather than to the viewport — so it scrolls away with the page.
  • Decorative overflow (e.g. .hero__art-ring--2 on the DigiDollar section uses inset: -25%) pushed the body's rendered width past the viewport. That extended the layout viewport used by position: fixed, which is why .scroll-top (right: 16px) landed ~25 px off-screen on a 390 px viewport.
  • The .btn primitive globally sets white-space: nowrap, so the long white-paper link couldn't wrap on narrow screens.

The fix

Three small, self-contained CSS changes (no HTML/JS touched):

File Change
css/base.css html { overflow-x: clip }, drop height: 100% on <body> (kept on <html>; min-height: 100svh on body already handles the fill-viewport case), and add overflow-x: clip to section so decorative art can't push the body wider than the viewport.
css/components.css Under @media (max-width: 560px), allow .btn to wrap (white-space: normal; overflow-wrap: anywhere). Also text-align: center; max-width: 100% and flex: none on the button icon so an icon can't push text past the edge.
css/dgb.min.css Rebuilt via node tools/build-css.mjs.

overflow-x: clip (vs. hidden) prevents the horizontal scrollbar without creating a scroll container, so position: sticky keeps working.

Verification

On a 390 × 844 mobile viewport of the preview build:

  • document.documentElement.scrollWidth === clientWidth → no horizontal scroll.
  • window.scrollTo(100, 0) leaves scrollX === 0.
  • .nav.getBoundingClientRect().top === 0 at every scroll offset past the ticker.
  • .scroll-top sits at right: 16px inside the viewport again.

Screenshots (390 × 844, en-us)

Hero + sticky nav landing:

Hero top, sticky nav, no horizontal scrollbar

Sticky nav pinned mid-scroll with .scroll-top correctly placed:

Sticky nav pinned + scroll-to-top button visible bottom-right

Long ghost button now wraps to multiple lines inside the viewport:

White Paper button wraps cleanly inside viewport

Notes

  • Zero HTML/JS changes; per-locale index.html files are untouched.
  • No visual regression on desktop: the added overflow-x: clip on section matches the intended behavior on wider viewports where the decorative rings already fit inside their grid cells.
  • overflow-x: clip is supported in all current evergreen browsers (Chrome/Edge 90+, Firefox 81+, Safari 16+); if it's unsupported the fallback is exactly today's behavior (the scrollbar reappears; nothing else regresses).

- html: overflow-x: clip (prevents horizontal scrollbar without creating a scroll container, so position: sticky keeps working)
- body: drop height: 100% (a fixed-height body plus overflowing content broke position: sticky on the header); min-height: 100svh already handles the fill-viewport case
- section: overflow-x: clip so decorative art (e.g. .hero__art-ring--2 on DigiDollar with inset: -25%) can't push body wider than the viewport, which was also displacing the fixed .scroll-top button off-screen on mobile
- .btn: allow wrapping under 560px (overflow-wrap: anywhere) so long labels like 'DigiByte Technical Architecture (White Paper)' fit inside the viewport

@DGBNOOB DGBNOOB left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fix(mobile): sticky header, remove horizontal scrollbar, contain overflow — #181
Conversation comment by Dennis Pitallano includes the Preview (https://dg-bio.vercel.app/en-us/), the problem, root cause, fix, verification steps, screenshots, and notes.
Commits: 9c1f25e Files changed:
• css/base.css
• css/components.css
• css/dgb.min.css
I opened the website in a mobile browser to identify the issues. I observed:

  1. The header disappears when scrolling down.
  2. The page shifts horizontally, leaving a gap on the right side.
  3. The Back to Top button is partially off the page.
  4. The “DigiByte Technical Architecture (White Paper)” button is also off the page.
    When viewing the preview, the DigiByte header stays in place while scrolling from top to bottom. The page no longer shifts horizontally or shows a right side gap. The DigiByte Technical Architecture (White Paper) button now wraps correctly, is centered, and remains fully on the page. The Back to Top button is also properly positioned.
    The only issue I noticed is that the Back to Top button requires at least two presses: the first press triggers a glow effect, and the second press scrolls the page to the top. This may be intentional behavior to prevent accidental activation, but I wanted to note it.
    The three changed files are CSS, which may require a more technical reviewer for deeper verification. However, the problem, root cause, fix, verification steps, screenshots, and notes provide a clear explanation, and all fixes are visible in the preview (https://dg-bio.vercel.app/en-us/).
    This review was not tested beyond comparing the live website with the preview containing the fixes. If the Vercel preview is considered sufficient for validation, then I recommend approval.

cACK

@ycagel ycagel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cACK

@ycagel
ycagel merged commit 66d7337 into DigiByte-Core:master Aug 19, 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.

3 participants