scrollIntoView causes WKWebView to be partially unresponsive

Originator:vidar.ramdal
Number:rdar://33874196 Date Originated:14.08.2017
Status:Open Resolved:
Product:iOS + SDK Product Version:11.0 15A5341e
Classification: Reproducible:Always
 
Area:
WebKit

Summary:
In some cases, calling Element.scrollIntoView in a JavaScript application running in a WKWebView causes the WKWebView component to become unresponsive to clicks.

Please see the attached Xcode testcase project, which was created with Xcoe 9.0 beta 5 (9M202q).

Steps to Reproduce:
Build the attached project, and run it on an iPhone 6 simulator with iOS 11 Beta (most recently tested with 11.0 15A5341e).

When running, the application shows a list of 5 step. Click on them in sequence. Do not scroll the content within the app - the app does some scrolling itself, to demonstrate the problem. 

The app also shows a bordered box with a counter in it. Pay attention to what happens with the counter.
Notice what (does not) happen when clicking on step 5.

Expected Results:
The click counter increases on step 1, 3 and 5

Observed Results:
The click counter increases on step 1 and 3, but not on step 5. In fact, the other clickable links, and most of the UI is unresponsive at this point.

Refer to attached Screenshot-1.png. 
Inspect the web application with Safari Developer Tools. Use the Inspect tool (1) and click on link 5 in the application (2). Notice how this highlights the HTML root element (3), not the DIV you actually clicked on, in the inspector.

If you now manually scroll the web page back to top, the links become responsive again.

Version:
iOS 11.0 (15A5341e)

Notes:
The problem seems to be related to the scrollIntoView JavaScript DOM method. It does not occur with other scroll methods we have tested, such as setting the scrollTop property.

Configuration:
This occurs in all tested iOS 11.0 beta configurations. This does NOT occur in all tested iOS 10.3.1 configurations.

Comments

The problem seems to have been resolved in iOS 11.2. I can no longer reproduce the issue in iOS 11.2, 11.3 or 11.4.

By vidar.ramdal at April 5, 2018, 1:21 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!