fix(explore): reset scroll position when category filter changes - #887
Open
Rafiat30 wants to merge 2 commits into
Open
fix(explore): reset scroll position when category filter changes#887Rafiat30 wants to merge 2 commits into
Rafiat30 wants to merge 2 commits into
Conversation
Switching the active category previously left the viewport at its prior scroll offset, which could strand users deep in a now-stale list. Scroll back to the top whenever activeCategory changes. Refs Iris-IV#561
|
@Rafiat30 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
Adds regression coverage for the scroll-to-top-on-category-change fix:
confirms window.scrollTo({ top: 0 }) fires when the active category changes
and the filtered list updates, and confirms it does not fire again for a
re-click of the already-active category (no-op state change).
Refs Iris-IV#561
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
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.
Closes #561
Summary
ExploreClient.tsxhas no search box, URL params, or cursor-based pagination — it's a client-side category-pill filter overuseCampaigns(). The pagination/cursor reset issue as originally described actually lives againstCausesClient.tsx, which already resets its page state (visibleCount) on every filter change. The remaining gap inExploreClientwas UX-adjacent: switching categories didn't reset scroll position, so users could be left stranded deep in a now-stale list.Changes
src/app/[locale]/explore/ExploreClient.tsx— scrolls back to the top of the page wheneveractiveCategorychanges.How to test
/explore.npm run typecheck