NEW285306
Prepending a new element into scroll-snap container causes a scroll
https://bugs.webkit.org/show_bug.cgi?id=285306
Summary Prepending a new element into scroll-snap container causes a scroll
Justin Ridgewell
Reported 2025-01-02 10:50:20 PST
Created attachment 473748 [details] Reproduction demo Setup: We have a scroll-snap container that we lazily insert new children as needed. The children are absolutely positioned within the container so that they're visually in the correct order. When we append children _after_ the currently visible child, the container's scroll width increases but we maintain our position. But, if we _prepend_ a new child, we see a scroll happen to the newly inserted child. Both Chrome and Firefox maintain the currently visible child, so I think this is a bug with Safari. Steps: 1. [Open demo](https://output.jsbin.com/qudumap/quiet) 2. Notice we're on "Card 10" 3. Click `insertBefore` button to prepend child 4. Notice we've scrolled to "Card 9".
Attachments
Reproduction demo (2.35 KB, text/html)
2025-01-02 10:50 PST, Justin Ridgewell
no flags
Bug demo screencast (266.41 KB, video/mp4)
2025-01-02 10:51 PST, Justin Ridgewell
no flags
Justin Ridgewell
Comment 1 2025-01-02 10:51:22 PST
Created attachment 473749 [details] Bug demo screencast Attaching screencast of the bug
Radar WebKit Bug Importer
Comment 2 2025-01-09 10:51:14 PST
Simon Fraser (smfr)
Comment 3 2025-01-09 12:07:18 PST
I can't connect to https://output.jsbin.com
Justin Ridgewell
Comment 4 2025-01-14 11:40:03 PST
The reproduction is also attached as an html file to the issue.
Note You need to log in before you can comment on or make changes to this bug.