Commit b7b4c79
authored
FEAT : return to top button added (enhancement) (JhaSourav07#547)
## Description
Fixes JhaSourav07#539
This PR implements a responsive and accessible “Back to Top” button
across the web application to improve navigation and user experience on
long-scroll pages.
Previously, users had to manually scroll back to the top after
navigating through lengthy sections, which reduced usability, especially
on mobile devices and content-heavy pages.
This fix introduces a floating action button that appears after
scrolling beyond a certain threshold and smoothly returns the user to
the top of the page while preserving the existing UI behavior and
responsiveness.
## Changes Implemented
Added a reusable Back to Top component with:
- Smooth scrolling functionality
- Scroll position detection
- Conditional rendering after a scroll threshold
- Responsive positioning for mobile and desktop
- Light/Dark theme compatibility
- Accessibility support using aria-labels and keyboard focus handling
## Added defensive UI handling for:
Small screen responsiveness
Preventing overlap with important UI elements
Consistent visibility across different layouts
## Root Cause
The application previously lacked a quick navigation mechanism for
returning to the top of long pages:
// No dedicated return-to-top functionality existed
Because of this:
users relied on manual scrolling
navigation became inconvenient on long pages
mobile usability was reduced
overall UX consistency was impacted
## Validation
Successfully verified with:
npm run test
npm run lint
npm run build
## Test Results
1. All test suites passed successfully
2. Production build compiled successfully
3. Verified responsive behavior across screen sizes
4. Verified smooth scrolling functionality
5. Verified dark/light theme compatibility
<html>
<body>
<!--StartFragment--><h2><span>Runtime Validation</span></h2><p
class="isSelectedEnd"><span>Tested manually across:</span></p>
Scenario | Result
-- | --
Desktop scrolling | Smooth behavior
Mobile scrolling | Responsive positioning
Theme switching | Fully compatible
Long content pages | Stable visibility
Accessibility checks | Passed
<!--EndFragment-->
</body>
</html>
## Impact
This PR improves:
user navigation experience
accessibility and usability
mobile responsiveness
UI consistency across pages
while preserving:
existing page layouts
theme behavior
application performance
backward compatibility
## Pillar
🎨 Pillar 1 — New Theme Design
🛠️ Other (UI Enhancement, Accessibility, Navigation Improvement)
## Visual Preview
N/A — UI navigation enhancement
## Checklist before requesting a review:
- [x] I have read the CONTRIBUTING.md file.
- [x] I have tested these changes locally
(localhost:3000/api/streak?user=YOUR_USERNAME).
- [x] I have run npm run format and npm run lint locally and resolved
all errors.
- [x] My commits follow the Conventional Commits format.
- [x] I have started the repo.
- [x] I have made sure that I have only one commit in this PR.
- [x] All tests and production builds pass successfully.
## BEFORE
<img width="1198" height="422" alt="image"
src="https://github.com/user-attachments/assets/9c5249b2-62af-4f11-a581-3634fc1ebb66"
/>
## AFTER
<img width="1217" height="428" alt="Screenshot 2026-05-27 101232"
src="https://github.com/user-attachments/assets/c8548a7f-d22f-4669-ad48-50a1023147b9"
/>2 files changed
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments