Skip to content

fix(website): paint landing code editor scroller on iOS#188

Merged
zantvoort merged 1 commit into
mainfrom
fix/ios-landing-editor-black-scroll
Jul 6, 2026
Merged

fix(website): paint landing code editor scroller on iOS#188
zantvoort merged 1 commit into
mainfrom
fix/ios-landing-editor-black-scroll

Conversation

@zantvoort

Copy link
Copy Markdown
Collaborator

Problem

On iOS, scrolling the landing-page code editor horizontally (to reach code that runs off-screen) reveals a black region instead of the code — the off-screen columns are unreadable.

Cause

The code editor's #code <pre> and the "Show SQL" panel #sqlpanel use overflow-x:auto for horizontal scrolling on narrow screens. Both were transparent and relied on their parent's background (.codearea gradient / .sqlconsole) showing through.

iOS Safari puts an overflow-x:auto element on its own compositing layer. When that layer has no background of its own, Safari does not paint the ancestor's background into the scrolled-in region — it composites black backing store instead. That's the black area users see when scrolling to off-screen code.

Fix

Give each horizontal scroller its own opaque background matching its container:

  • #codevar(--panel) (the codearea gradient's top stop, so the seam is imperceptible)
  • #sqlpanelvar(--statusbg) (exactly matches .sqlconsole, no visual change)

Both are id selectors, so they override .storm-home pre{background:transparent} by specificity. Desktop appearance is effectively unchanged; the difference only matters on the iOS scroll layer.

Verification

  • Confirm on a real iOS device: scroll a long code line horizontally in the landing editor and in the "Show SQL" panel — the off-screen text should render normally, not black.

Note: I could not test on a physical iOS device. This opaque-background approach is the standard remedy for this iOS symptom and is low-risk. If any black region somehow persists, the fallback would be a compositing hint (transform:translateZ(0)) on #code, deliberately avoided here to keep the change minimal.

The landing page code editor (#code) and Show-SQL panel (#sqlpanel) use
overflow-x:auto, but were transparent and relied on their parent's
background showing through. On iOS Safari an overflow-x:auto element gets
its own compositing layer; a transparent one paints the scrolled-in
(off-screen) region black instead of the ancestor background, so code
scrolled into view was unreadable.

Give each horizontal scroller its own opaque background matching its
container (--panel for #code, --statusbg for #sqlpanel). Both are id
selectors, so they override .storm-home pre{background:transparent} by
specificity; desktop appearance is unchanged.
@zantvoort zantvoort merged commit f1ac894 into main Jul 6, 2026
6 checks passed
@zantvoort zantvoort deleted the fix/ios-landing-editor-black-scroll branch July 6, 2026 16:42
zantvoort added a commit that referenced this pull request Jul 6, 2026
Follow-up to #188, which gave the horizontal scrollers opaque
backgrounds but did not fix the symptom on iOS: scenes rendering with
the first ~13 characters of every line cut off.

The actual cause is a retained scroll offset, not paint. Any touch pan
on the code block (including an accidental diagonal swipe while
scrolling the page) leaves #code scrolled right. Desktop self-heals on
the next scene: the near-empty first render collapses scrollWidth and
the browser clamps scrollLeft back to 0. iOS Safari does not clamp the
offset of a composited scroller when its content shrinks, so the stale
offset survives every innerHTML replacement and each new scene types
into a shifted viewport.

Reset scrollLeft explicitly when a scene starts typing, when the
finished snippet is rendered, and when the Show-SQL panel content is
replaced.
zantvoort added a commit that referenced this pull request Jul 6, 2026
…#190)

* fix(website): wrap landing editor code on phones instead of scrolling

Third pass at the iOS landing editor bug, replacing the mechanism
instead of nudging it. #188 (opaque scroller backgrounds) and #189
(explicit scrollLeft resets) are both live and neither cured it: on an
iPhone the typed code still renders shifted left by a uniform number of
characters, and panning repaints only part of the content. iOS Safari
desyncs the painted tiles of a composited overflow-x scroller whose DOM
is replaced every frame by the typewriter, so no scroll-position or
background fix can reach it.

Below 760px the editor now wraps long lines (pre-wrap) instead of
scrolling them, with a slightly smaller font to limit wrapping. With no
horizontal scroller there is no composited scroll layer to go stale.
The gutter is hidden there too: line numbers cannot align once a
logical line spans several visual rows. The Show-SQL panel gets the
same treatment. Desktop and tablet widths are unchanged.

* docs(blog): quote the closing line as the why-we-built-storm abstract

Replace the dek with the post's own closing line, set as a quote.
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