Manually setting scroll position does not respect scroll snap rules
Categories
(Core :: Layout: Scrolling and Overflow, defect)
Tracking
()
People
(Reporter: sean, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Steps to reproduce:
Codepen: https://codepen.io/sean-perkins-ionic/pen/OJQLVGd
The example has a vertical container using scroll snap for individual items. The scroll container has 3 empty items at the top and bottom of the container, these items use scroll-snap-align: none
.
The vertical container uses scroll-snap-type: y mandatory
and should snap to the nearest snappable item.
Actual results:
When manually setting the scroll position of the container, the container does not snap to the nearest valid item. Instead, it can be snapped to the items that use scroll-snap-align: none
; which is incorrect.
If you click "Scroll Bottom" in the CodePen example, it will scroll the container to the container's scroll height. Comparison across other browsers, you will observe that Firefox does not snap to the nearest valid item. Chrome and Safari both snap correctly.
Expected results:
Scroll snap should respect the assigned rules and snap to the nearest item regardless if you scroll or manually set the scroll position.
Updated•3 years ago
|
Comment 1•2 years ago
|
||
Not totally sure if scroll-snapping behavior belongs more to Layout or to APZ....
Hiro, is this something you could look into?
Comment 2•2 years ago
|
||
This is one of the cases that bug 1766890 solves.
Description
•