Closed Bug 1766890 Opened 2 years ago Closed 2 years ago

Manually setting scroll position does not respect scroll snap rules

Categories

(Core :: Layout: Scrolling and Overflow, defect)

Firefox 99
defect

Tracking

()

RESOLVED DUPLICATE of bug 1766192

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.

Component: General → Layout: Positioned

Not totally sure if scroll-snapping behavior belongs more to Layout or to APZ....
Hiro, is this something you could look into?

Severity: -- → S3
Component: Layout: Positioned → Layout: Scrolling and Overflow
Flags: needinfo?(hikezoe.birchill)

This is one of the cases that bug 1766890 solves.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(hikezoe.birchill)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.