Skip to content

Fix reading progress bar initial value#45

Merged
rockoder merged 1 commit intomasterfrom
fix-reading-progress-start-9015881955667487806
Feb 1, 2026
Merged

Fix reading progress bar initial value#45
rockoder merged 1 commit intomasterfrom
fix-reading-progress-start-9015881955667487806

Conversation

@rockoder
Copy link
Copy Markdown
Owner

@rockoder rockoder commented Feb 1, 2026

The reading progress bar was showing ~25% progress even when a post was just opened at the top of the page. This was due to the calculation logic which considered the portion of the article visible in the initial viewport as "completed".

I updated src/components/ReadingProgress.astro with a new formula:

  • scrollRange = articleTop + articleHeight - windowHeight
  • progress = scrollY / scrollRange

This ensures that at scrollY = 0, the progress is 0%. The progress reaches 100% when the bottom of the article aligns with the bottom of the viewport. I also used getBoundingClientRect() for more robust element positioning.

Verified the fix using Playwright screenshots and build checks.


PR created automatically by Jules for task 9015881955667487806 started by @rockoder

Adjusted the logic in `ReadingProgress.astro` to ensure the progress
bar starts at 0% when the page is at the top. The previous
implementation included the initial viewport height in the progress,
leading to a non-zero start (around 25-40%).

The new calculation uses `getBoundingClientRect()` for accuracy and
defines the scroll range from the top of the page to the point where
the bottom of the article content reaches the bottom of the viewport.

Co-authored-by: rockoder <2136164+rockoder@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@rockoder rockoder merged commit 8196b57 into master Feb 1, 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.

1 participant