Skip to content

Conversation

@rdsingh120
Copy link

@rdsingh120 rdsingh120 commented Oct 18, 2025

Description

Fixes #144

This PR implements a “Back to Top” button to enhance navigation on long pages.
The button appears when the user scrolls down and smoothly scrolls the page back to the top when clicked.

1. What was Changed

  • Added a new Back to Top button (<button id="backToTopBtn">) in the main HTML template (templates/boneset.html).
  • Added a new JavaScript file templates/js/BackToTopButton.js that:
    • Shows or hides the button based on scroll position.
    • Smoothly scrolls to the top when the button is clicked.
  • Added new CSS styles for the button, including transitions for fade-in/out and hover animation.

2. Why it was Changed

On long pages, users had to manually scroll back up, which was inconvenient and inconsistent with modern UX expectations. Adding a “Back to Top” button provides a smoother experience, making navigation faster and more user-friendly.

3. How it was Changed

  • Added a fixed-position Back to Top button in the HTML.
  • Implemented scroll detection and smooth scroll logic in a new JS file (BackToTopButton.js).
  • Styled the button in CSS for fade-in visibility and hover animation.

4. Screenshots

feature

@rdsingh120 rdsingh120 requested a review from UcheWendy as a code owner October 18, 2025 08:53
Copy link
Collaborator

@UcheWendy UcheWendy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review changes requested and update as needed. thank you

@rdsingh120 rdsingh120 requested a review from UcheWendy October 23, 2025 03:55
@UcheWendy
Copy link
Collaborator

pLEASE PULL LATEST UPDATE FROM MAIN BEFORE PUSHING YOUR CODE FOR PR
Remove unrelated changes
Revert templates/style.css to main unless there are lines strictly for the Back-to-Top button.

Revert duplicated header/sidebar blocks in templates/boneset.html. Keep only one #badge, one #sidebar-container, and one #toggle-sidebar.

Add the minimal Back-to-Top implementation (HTML button + small CSS block + small JS module), as shown above.

Meet acceptance criteria

Button is hidden at top.

Appears after scrolling down (e.g., 300px).

Clicking smoothly returns to top.

Disappears again at the top.

Accessibility + UX

aria-label="Back to top", visible focus state, keyboard activation.

Respect prefers-reduced-motion.

Sanity checks

Run a formatter/linter for CSS and HTML (fix the broken CSS if anything remains after you revert).

Test on mobile and desktop; ensure the button doesn’t overlap your footer or floating elements.

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.

Feature: Add a "Back to Top" Button

2 participants