Skip to content

Commit

Permalink
Use scrollIntoView, fixes #562
Browse files Browse the repository at this point in the history
Instead of doing scrollTo(0,0) use scrollIntoView to get the `section#products` start to be visible.

WIP, still requires a css rule
  • Loading branch information
tswfi committed Nov 20, 2023
1 parent 986d1a2 commit 008006b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/modules/facetedsearch/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default () => {
prestashop.on(events.updateProductList, (data: Record<string, never>) => {
updateProductListDOM(data);
useQuantityInput();
window.scrollTo(0, 0);
// list was updated, scroll back up to to start of the list
document.getElementById('products')?.scrollIntoView(true);
});
};

0 comments on commit 008006b

Please sign in to comment.