Open Bug 1894400 Opened 1 year ago Updated 7 months ago

scrollBy() with smooth scrolling gets stuck with scroll snap

Categories

(Core :: Panning and Zooming, defect, P3)

Firefox 125
defect

Tracking

()

UNCONFIRMED

People

(Reporter: icheherntion, Unassigned)

References

(Depends on 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0

Steps to reproduce:

Tried to use JavaScript scrollBy() with behavior: smooth to move to the next scroll snap position.

Actual results:

JS-scrolling with behavior: smooth gets stuck, no problem with behavior: instant or auto.

Code example: https://codepen.io/RushCapricornChicken/pen/abxrymq

Seems like the final scroll snap position isn't reached. If I deactivate smooth and click again, it snaps a few pixels to the current snap position.

Also happens when clicking on the empty space besides the scollbar.

Moving the scrollbar or using swipe work without problems.

Expected results:

Scroll to the next scroll snap position. Works in Chrome or other Webkit browsers.
Tested in Firefox 125.0.2 64bit (Windows 10) and Firefox 125.0.3 64bit (Ubuntu 22.04)

The Bugbug bot thinks this bug should belong to the 'Core::Panning and Zooming' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Panning and Zooming
Product: Firefox → Core

The severity field is not set for this bug.
:botond, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(botond)

Do you see this problem consistently (i.e. you can never reach the final snap position by pressing the forward button when "Smooth scrolling" is checked), or does it happen intermittently?

Flags: needinfo?(botond)

The first one is usually working. At least I couldn't reproduce the problem now for the first one. After that it seems mostly random when it happens. And It also seems like it's a timing issue.

In some positions it's working again if you wait a little, but some never recover (or at least not fast enough for me to see it)

I also fiddled around with the distance scrolled, but that doesn't have a huge effect either, if any. Could also be due to the randomness of the behaviour.

Marking as S3 for now as other methods of scrolling can be used as a workaround when it occurs.

Bug 1774315 is a potential culprit (at least it would explain the intermittent nature of the problem if, depending on the timing of the scroll animation, we sometimes ran into an issue related to scroll position rounding), we should re-test this once it is fixed.

Severity: -- → S3
Depends on: 1774315
Priority: -- → P3
Depends on: 1946610
No longer depends on: 1774315
You need to log in before you can comment on or make changes to this bug.