WKWebView UIScrollView scrolling indicator default inset behavior is broken for iPhone X

Originator:cyphactor
Number:rdar://35755130 Date Originated:11/29/2017
Status:Open Resolved:
Product:iOS + SDK Product Version:11.1.2 (15B202)
Classification:Bug Reproducible:Yes
 
Area:
UIKit

Summary:

There is a problem with the safeAreaLayoutGuide UIScrollView contentInsetAdjustmentBehavior default of '.automatic' in which it insets the content of the scroll view over too far when in landscape orientation.

Steps to Reproduce:

1. Create a Single View application
2. Create a ViewController and set it as the rootView of the window in the AppDelegate and make the window key and visible.
3. In the ViewController create a WKWebView instance and constrain it to the safeAreaLayoutGuide.
4. Load some content in the WKWebView
5. Start the application in Portrait Orientation
6. Rotate the device to Landscape Orientation

I have provided a project that reproduces this which is where the attached screenshot comes from. You can see the red stripe in horizontal orientation which is the incorrect inset. If you use the provided project to reproduce it is as simple as following these steps to reproduce.

1. Launch the app with the device in Portrait Orientation
2. Rotate the device to the right/left to enter Right/Left Landscape Orientation
3. See the red stripe to the right of the content view, this is the background of the UIScrollView that shouldn't be visible.

I found a work around to this by setting the contentInsetAdjustmentBehavior of the scrollView to .scrollableAxes as follows:

webView.scrollView.contentInsetAdjustmentBehavior = .scrollableAxes

However, I still believe the default behavior is broken and unexpected.

Expected Results:

I expected that in the default state constraining it to the safeAreaLayoutGuide would make it behave correctly in both Portrait and Landscope Orientations.

Actual Results:

If you follow the steps to reproduce the content view of the WKWebView's UIScrollView will be inset further from the right of the safeAreaLayoutGuide when it shouldn't be

Version/Build:

iOS 11.1.2 (15B202)

Comments


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!