Skip to content

[FEATURE] Add Scroll-to-Top Button with Reading Progress Indicator #1583

@ArshiBansal

Description

@ArshiBansal

Feature description

Add a floating Scroll-to-Top button that becomes visible when users scroll down the page. The button should also include a visual progress indicator showing how much of the page has been read or scrolled through. This enhancement will improve navigation and provide users with better awareness of their reading progress, especially on long pages with extensive content.

Problem this solves

Currently, users must manually scroll back to the top of the page after reaching the bottom of long content sections. This can be inconvenient and negatively affect the user experience. Additionally, users have no indication of how far they have progressed through the page, making navigation less intuitive.

Proposed solution

Implement a floating button positioned at the bottom-right corner of the screen that:

  • Appears after the user scrolls beyond a predefined threshold.
  • Smoothly scrolls the page back to the top when clicked.
  • Displays the current scroll progress using a circular or linear progress indicator.
  • Updates the progress indicator in real time based on the user's scroll position.
  • Maintains responsiveness across desktop, tablet, and mobile devices.
  • Includes accessible labels and keyboard navigation support.

Technical implementation idea

  • Use the window.scrollY and document height values to calculate scroll percentage.
  • Attach a scroll event listener to update progress dynamically.
  • Use CSS animations/transitions for smooth appearance and interaction.
  • Use window.scrollTo({ top: 0, behavior: "smooth" }) for smooth scrolling.
  • Ensure proper ARIA labels and focus states for accessibility.

Alternatives considered

  • A simple Scroll-to-Top button without a progress indicator.
  • A fixed progress bar at the top of the page without scroll-to-top functionality.
  • Browser-native scrolling behavior without additional navigation aids.

While these alternatives provide partial functionality, combining both features into a single component offers a more complete and user-friendly experience.

Additional context

This feature is particularly beneficial for pages containing lengthy articles, documentation, guides, blogs, FAQs, or project information. The progress indicator helps users understand their current position within the content while the scroll-to-top action improves overall navigation efficiency.

Expected behavior

  1. User scrolls down the page.
  2. The button becomes visible after a certain scroll threshold.
  3. The progress indicator reflects the percentage of the page viewed.
  4. Clicking the button smoothly returns the user to the top of the page.
  5. Progress resets once the top of the page is reached.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions