TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

CSS scroll snap slide deck that supports live coding

33 pointsby damirover 3 years ago

4 comments

chrismorganover 3 years ago
The example commits the perennial sin of using 100vw, so that it’s somewhat broken on all platforms where scrollbars take width. There is unfortunately probably no way of getting this specific case correct without JavaScript.<p>You may have heard of new viewport units in the pipeline to fix the problems with viewport units, but <i>ugh</i>, they’re only interested in fixing the problems caused by retractable UI chrome, common in <i>mobile</i> browsers, and are still frustratingly utterly broken by design for most desktop platforms. <a href="https:&#x2F;&#x2F;github.com&#x2F;w3c&#x2F;csswg-drafts&#x2F;issues&#x2F;6551" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;w3c&#x2F;csswg-drafts&#x2F;issues&#x2F;6551</a>, <a href="https:&#x2F;&#x2F;github.com&#x2F;w3c&#x2F;csswg-drafts&#x2F;issues&#x2F;6026" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;w3c&#x2F;csswg-drafts&#x2F;issues&#x2F;6026</a>. Until all of this stuff gets sorted out, I continue to advise against at least viewport width units in <i>any</i> capacity.<p>I would also add that scroll snapping in general is a misguided feature, enabling functionality that is almost never actually desirable. My observation is that places that use it are almost universally frustrating in some way. Browsers’ implementations are definitely getting better, so that the viewport units problem is almost all that’s left for this example, though accidentally swiping&#x2F;scrolling past more than one slide is still a problem.
aehardingover 3 years ago
CSS scroll snap (and thus, the demo) broken on firefox + macOS unfortunately<p><a href="https:&#x2F;&#x2F;bugzilla.mozilla.org&#x2F;show_bug.cgi?id=1737820" rel="nofollow">https:&#x2F;&#x2F;bugzilla.mozilla.org&#x2F;show_bug.cgi?id=1737820</a>
udbhavsover 3 years ago
I&#x27;d love to use scroll-snap more since horizontal snapping is such a common use case and the alternatives are all JS-heavy, but it straight up doesn&#x27;t work for me on most of the devices I&#x27;ve tried it on (even the MDN docs)
lelandfeover 3 years ago
Neat trick! I’ve made style elements visible before, but have never considered making them contenteditable