-
Notifications
You must be signed in to change notification settings - Fork 119
Description
Sometimes scrollTo(0,0) does not work in firefox. This is really strange and I cannot even reproduce this all the time, but enough to be really annoying :D
Steps to reproduce
- with "default demo products" change the pagesize to 3 (easier to get pager)
- go to "art" category (it should have three pages as the pagesize is small)
- scroll a bit to see the pager (important, also it seems that the viewport size also affects this a bit)
- change page
=>tries to scroll to top but it doesn't always happen (no errors, nothing).window.scrollTo(0, 0);
It looks like firefox gets confused when the content changes and it doesn't always understand that it should scroll.. (also tried adding a small delay with setTimeout but that didn't seem to work either)
I can force it to work consistently by adding window.scrollTo(0,1) before the window.scrollTo(0,0) but that seems wrong.
This does not seem to ever happen with chrome.
As a side not the scrolling should probably happen to be at the top of <div id="products"> so that for mobile users the products are shown even if the header is tall.. In place of window.scrollTo(0,0) should be something like
document.getElementById('products').scrollIntoView(true); and as we have a fixed header give it some scroll margin
section#products {
scroll-margin-top: 150px; /* really the height of header */
}In my opinion the scroll-margin-top should be set so that in desktop view the text "There are 8 products" is still visible and in mobile view filters and sort order are still visible