algolia / instantsearch

⚑️ Libraries for building performant and instant search experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.

Home Page:https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Install react-instantsearch-nextjs
  2. Pass routing
  3. Add <Pagination>
  4. 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.

Hey @web-programmer-here

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);
  }
/>