Keyboard inset adjustment double-counts toolbar height in WKWebView + UIScrollView

Originator:james.reggio
Number:rdar://22413005 Date Originated:08/24/2015
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.4 (12H143)
Classification:UI/Usability Reproducible:Always
 
[Want to discuss? Get in touch with me @jamesreggio.]

Since iOS 7, the navigation bar and toolbar in a UINavigationController are designed to render atop the content of the current UIViewController. In order to prevent these bars from occluding the contents of the view, UINavigationController will (under certain conditions) automatically reach down the view hierarchy and adjust the insets of the primary UIScrollView, such that the content is padded by the height of these bars.

The system keyboard is also designed to occlude the bottom half of the screen by default. In most cases, this is undesirable, so the app developer is expected to subscribe to NSNotificationCenter keyboard events and adjust the UIScrollView insets themselves.

WKWebView automatically subscribes to these keyboard events and adjusts its UIScrollView insets to prevent keyboard occlusion. However, instead of taking the maximum of the keyboard and toolbar height (both of which are anchored at the bottom of the screen), it sums them together, creating extra bottom padding equivalent to the height of the toolbar.

Steps to Reproduce:
1. Load a web page in WKWebView within a UINavigationController with a toolbar present.
2. Observe that the contentInset.bottom is appropriately set to size of the toolbar.
3. Place focus into a text input on the web page. The keyboard should open.
3. Scroll to the bottom of the web page.

Expected Results:
The contentInset.bottom should not have any excess padding.

Actual Results:
The contentInset.bottom has an additional ~44px of padding (equal to the height of the toolbar in the UINavigationController).

Version:
iOS 8.4 (12H143)

Notes:
Additional details about API calls are chronicled here:
https://gist.github.com/jamesreggio/d5233dba36b184ba3af3

Configuration:
iPhone 6 on iOS 8.4

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!