From 8709c137c7820fc0b3d751c2c151736baf587e77 Mon Sep 17 00:00:00 2001 From: bouaik Date: Fri, 1 Nov 2024 11:39:41 +0100 Subject: [PATCH] Scroll to top when using pagination --- app/webpacker/controllers/search_controller.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/webpacker/controllers/search_controller.js b/app/webpacker/controllers/search_controller.js index c79774b52af..49ee75a7b52 100644 --- a/app/webpacker/controllers/search_controller.js +++ b/app/webpacker/controllers/search_controller.js @@ -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;