diff --git a/app/webpacker/controllers/search_controller.js b/app/webpacker/controllers/search_controller.js index 49ee75a7b52..dd34b33a353 100644 --- a/app/webpacker/controllers/search_controller.js +++ b/app/webpacker/controllers/search_controller.js @@ -10,7 +10,8 @@ export default class extends Controller { changePage(event) { const productsForm = document.querySelector("#products-form"); - productsForm.scrollIntoView({ behavior: "smooth" }); + if (productsForm) productsForm.scrollIntoView({ behavior: "smooth" }); + this.page.value = event.target.dataset.page; this.submitSearch(); this.page.value = 1;