Bug 239063 - Smooth scroll on iframe fails on iOS
Summary: Smooth scroll on iframe fails on iOS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: Safari 15
Hardware: iPhone / iPad iOS 15
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-11 02:30 PDT by Johannes Odland
Modified: 2022-09-29 09:23 PDT (History)
10 users (show)

See Also:


Attachments
Patch (35.84 KB, patch)
2022-04-12 14:07 PDT, Simon Fraser (smfr)
dino: review+
Details | Formatted Diff | Diff
Video of issue in main frame (4.49 MB, video/mp4)
2022-04-28 22:36 PDT, Johannes Odland
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Odland 2022-04-11 02:30:10 PDT
element.scrollIntoView() does not work when using `scroll-snap-type: y mandatory` on `:root` in iOS.

How to replicate: 
1. Open debug view of https://codepen.io/johannesodland/pen/PoEaMWO on iOS Safari 15
2. Click next to trigger scrollIntoView

Expected result: Second section scrolls into view.

Result on iOS Safari: Nothing happens.

Other browsers and desktop safari works as expected.
Comment 1 Simon Fraser (smfr) 2022-04-11 19:43:36 PDT
This works in the main frame, but fails inside an <iframe>, in my testing.
Comment 2 Radar WebKit Bug Importer 2022-04-11 19:43:57 PDT
<rdar://problem/91603363>
Comment 3 Simon Fraser (smfr) 2022-04-11 19:47:45 PDT
ScrollingTreeFrameScrollingNodeRemoteIOS fails to implement startAnimatedScrollToPosition.
Comment 4 Simon Fraser (smfr) 2022-04-12 14:07:14 PDT
Created attachment 457444 [details]
Patch
Comment 5 Dean Jackson 2022-04-12 14:43:16 PDT
Comment on attachment 457444 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=457444&action=review

> LayoutTests/fast/scrolling/ios/constrain-scrollintoview-position.html:15
> +          let iframe = document.getElementsByTagName('iframe')[0];

Nit: extra space indent
Comment 6 Simon Fraser (smfr) 2022-04-13 09:46:12 PDT
https://trac.webkit.org/changeset/292812/webkit
Comment 7 Johannes Odland 2022-04-28 22:31:34 PDT
The issue is not isolated to iframes. 

It was detected in a regular web page, and the code pen when opened in debug-view is a regular web-page with no iframes.
Comment 8 Johannes Odland 2022-04-28 22:32:00 PDT
The issue is not isolated to iframes. 

It was detected in a regular web page, and the code pen when opened in debug-view is a regular web-page with no iframes.
Comment 9 Johannes Odland 2022-04-28 22:36:59 PDT
Created attachment 458571 [details]
Video of issue in main frame

Attaching video of issue in the main frame.
Comment 10 Simon Fraser (smfr) 2022-05-02 11:54:26 PDT
The main frame case was fixed by an earlier change. I just tested a recent build, and both work now.
Comment 11 Johannes Odland 2022-09-27 03:11:31 PDT
I found a new way to trigger this bug in the same codepen in iOS 16.
I registered it as a new issue here: https://bugs.webkit.org/show_bug.cgi?id=245722