You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(WEBUI) Spacebar key to go to next page breaks with browser zoom & some image aspect ratios #939
Bug Details
When viewing a gallery you're supposed to be able to push spacebar to go to the bottom of the page, then hit it again to go to the next page. However if my browser is not at 100% zoom, this functionality breaks for all galleries. However, even at 100% zoom, it still breaks on some pages if the scroll bar is in use. Notably this means users who use Fit To "Container" or "Width" setting will run into it breaking constantly.
I tested dozens of galleries, some would have the spacebar stop working on the first page, some at pages much later on. I noted down all the resolutions of each page and where it broke, to try and work out if it was caused by a later page exceeding the size of a previous page... thinking it might be some div fuckery but that wasn't it.
The issue is simply caused by the aspect ratio of the images:
2106 x 2962 (Spacebar working)
1998 x 3001 (Spacebar working)
2008 x 2993 (Spacebar broken, cant go to next page)
2060 x 3038 (Spacebar broken, cant go to next page)
2044 x 3040 (Spacebar broken, cant go to next page)
2577 x 3679 (Spacebar working)
5154 x 3679 (Spacebar working)
2646 x 3679 (Spacebar broken, cant go to next page)
5154 x 3679 (Spacebar working)
1300 x 1841 (Spacebar broken, cant go to next page)
2288 x 3200 (Spacebar broken, cant go to next page)
2287 x 3200 (Spacebar works)
1917 x 2934 (Spacebar broken, cant go to next page)
1300 x 1869 (Spacebar works)
My best theory is that the code doesn't work with fractual pixels, if the aspect ratio results in a fractual pixel. E.g the height ends up as 1000.7 and rounds up to 1001, instead of down to 1000, causing it to break because it thinks its not at the botom of the page?
Proposed Solutions
I tried testing these myself, but because Firefox Devtools affected the page height it made it impossible without building..
if ( element.scrollTop == (element.scrollHeight - element.offsetHeight) ) { From: https://stackoverflow.com/posts/54935662/revisions if ((window.innerHeight * window.devicePixelRatio + window.scrollY) >= document.body.offsetHeight * window.devicePixelRatio) { from chat GPT (Should account for browser scaling, but i think it might still break with the aspect ratio issue? May need to offset by an extra 1px somehow)
changed the title [-](WEBUI) Spacebar key unreliable in going to next page[/-][+](WEBUI) Spacebar key to go to next page breaks with browser zoom[/+]on Jan 11, 2025
changed the title [-](WEBUI) Spacebar key to go to next page breaks with browser zoom[/-][+](WEBUI) Spacebar key to go to next page breaks with browser zoom & some image aspect ratios[/+]on Jan 11, 2025
@Difegue Unfortunately the exact same issue is occurring in new release, works only when at 100% zoom, and even then still breaks on some images depending on the dimensions.
As an added suggestion, could space-bar scroll down to the bottom of the image, not the page. Then pushing it again goes to the next page? This would be better - more of the image would stay on screen.
that's unfortunate; I'm not able to repro the issue myself so I can't really do much besides shots in the dark.
If it helps you, it's possible to move the firefox devtools to a separate window, so they wouldn't interfere with the window size anymore when testing.
Activity
[-](WEBUI) Spacebar key unreliable in going to next page[/-][+](WEBUI) Spacebar key to go to next page breaks with browser zoom[/+][-](WEBUI) Spacebar key to go to next page breaks with browser zoom[/-][+](WEBUI) Spacebar key to go to next page breaks with browser zoom & some image aspect ratios[/+](#939) Try alternate way to detect bottom of page
Asinin3 commentedon Jan 13, 2025
@Difegue Unfortunately the exact same issue is occurring in new release, works only when at 100% zoom, and even then still breaks on some images depending on the dimensions.
As an added suggestion, could space-bar scroll down to the bottom of the image, not the page. Then pushing it again goes to the next page? This would be better - more of the image would stay on screen.
Difegue commentedon Jan 13, 2025
that's unfortunate; I'm not able to repro the issue myself so I can't really do much besides shots in the dark.
If it helps you, it's possible to move the firefox devtools to a separate window, so they wouldn't interfere with the window size anymore when testing.
Asinin3 commentedon Jan 16, 2025
Strange that you cant reproduce it, it happens for me with a fresh install of chrome too.