react-instantsearch-nextjs pagination doesnt move to top
web-programmer-here opened this issue Β· comments
π Current behavior
Using react-instantsearch-nextjs
with pagination, when you go to next or prev pages, the element doesnt scroll to the top and remains in same spot.
π Steps to reproduce
- Install react-instantsearch-nextjs
- Pass
routing
- Add
<Pagination>
- Click on page numbers
Live reproduction
NA
π Expected behavior
Maybe go to the top of the search element?
Package version
react-instantsearch-nextjs
Operating system
No response
Browser
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Linking this PR #5861 as it seems like it was purposely removed but it causing unexpected behavior for pagination.
We removed it because it was inconsistent with the rest of the library, we never set scroll up anywhere, you can check it for yourself with this simple React InstantSearch app : https://codesandbox.io/s/github/algolia/instantsearch/tree/templates/react-instantsearch
So this always was the expected behavior.
You can however implement it yourself on a widget basis :
<Pagination
onClick={() => {
scrollTo(0, 0);
}
/>