From 008006b641df451070037fd421c41cedc14364e1 Mon Sep 17 00:00:00 2001 From: Tatu Wikman Date: Mon, 20 Nov 2023 16:31:20 +0200 Subject: [PATCH] Use scrollIntoView, fixes #562 Instead of doing scrollTo(0,0) use scrollIntoView to get the `section#products` start to be visible. WIP, still requires a css rule --- src/js/modules/facetedsearch/update.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/modules/facetedsearch/update.ts b/src/js/modules/facetedsearch/update.ts index 39b2278cb..6658370d5 100644 --- a/src/js/modules/facetedsearch/update.ts +++ b/src/js/modules/facetedsearch/update.ts @@ -99,6 +99,7 @@ export default () => { prestashop.on(events.updateProductList, (data: Record) => { updateProductListDOM(data); useQuantityInput(); - window.scrollTo(0, 0); + // list was updated, scroll back up to to start of the list + document.getElementById('products')?.scrollIntoView(true); }); };