Bug 272079

Summary: [css-scroll-snap] Fragment links does not work with scroll-snap on root
Product: WebKit Reporter: Johannes Odland <johannes.odland>
Component: ScrollingAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, johannes.odland, nmouchtaris, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: Unspecified   
OS: iOS 17   
See Also: https://bugs.webkit.org/show_bug.cgi?id=255592
https://bugs.webkit.org/show_bug.cgi?id=245722
https://bugs.webkit.org/show_bug.cgi?id=251003

Johannes Odland
Reported 2024-04-03 02:47:30 PDT
Anchor links on a page with scroll-snap on the root/html element fails. Steps to reproduce: 1. Open https://johannesodland.github.io/browserbugs/2024/safari-scroll-snap-fragment-links-issue.html 2. Click on one of the anchor links Expected result: The linked fragment/section is scrolled into view. Actual result: The browser sometimes scrolls down to the relevant fragment, but snaps back to the top.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-04-03 10:06:36 PDT
Ahmad Saleem
Comment 2 2024-04-04 04:59:05 PDT
I am unable to reproduce on first load, although it is bit more involved in my case, where I have to navigate away from tab opened and then refresh tab few times to reproduce this reliably. @Johannes - is this used to work in earlier iOS versions by any chance you know and also if you have reliable reproduction steps, it would be good to add. :-)
Johannes Odland
Comment 3 2024-04-04 05:16:28 PDT
Thanks for testing Ahmad. Navigating to one fragment, and then to another seems to consistently reproduce the bug for me: 1. go to section 4 ( https://johannesodland.github.io/browserbugs/2024/safari-scroll-snap-fragment-links-issue.html#section-4 ) 2. Scroll to top 3. Click one of the anchor links
Johannes Odland
Comment 4 2024-11-19 10:02:44 PST
Retested on iOS 18.1, still failing.
Johannes Odland
Comment 5 2025-06-10 22:54:24 PDT
Retested on iOS 26 beta, still failing.
Johannes Odland
Comment 6 2025-12-05 04:44:52 PST
Retested on iOS 26.2. The issue seems partially solved. Fragment links now works, even after scrolling. It fails when clicking multiple fragment links after each other. 1. Click on "Section 1" – The browser scrolls to section 1 2. Scroll back to the top 3. Click on "Section 2" – The browser scrolls to section 2, but then immediately snaps back to the top of the page.
Note You need to log in before you can comment on or make changes to this bug.