Repository navigation
feat: a reading progress line at the top of each post - #33
Merged
Merged
Conversation
A 2px ochre line at the top of the view grows from the article's top reaching the top of the view to its end reaching the bottom. It is a CSS scroll-driven animation of a transform: no script, no scroll listener, nothing on the main thread. Browsers without scroll-driven animations show no line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A thin line at the top of the view that grows as the post is read, the usual cue for how much is left.
How. A CSS scroll-driven animation: the article is a view timeline (
view-timeline: --post), and a 2px--accentline, fixed at the top, scales on X fromcontain 0%(the article's top at the top of the view) tocontain 100%(its end at the bottom). No JavaScript and no scroll listener; it animates a transform only, which the compositor handles, so it neither touches the main thread nor delays the LCP (fades and opacity are avoided on purpose). Browsers withoutanimation-timelineshow no line, behind@supports.Checked. In
pnpm dev: the line is atscaleX(0)at the top of the post,0.4at 40 % of the article and1at its end.pnpm checkandpnpm buildpass; the Lighthouse job in CI measures it.