Skip to content

Commit

Permalink
Scroll to top when using pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
bouaik committed Nov 1, 2024
1 parent 49a24eb commit 8709c13
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/webpacker/controllers/search_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default class extends Controller {
}

changePage(event) {
const productsForm = document.querySelector("#products-form");
productsForm.scrollIntoView({ behavior: "smooth" });
this.page.value = event.target.dataset.page;
this.submitSearch();
this.page.value = 1;
Expand Down

0 comments on commit 8709c13

Please sign in to comment.