SFSafariViewController has an incorrect contentInset when keyboard is visible

Originator:james.reggio
Number:rdar://23706138 Date Originated:12/01/2015
Status:Fixed Resolved:Fixed in iOS 10.0.1
Product:iOS SDK Product Version:iOS 9.1 (13B137)
Classification:UI/Usability Reproducible:Always
 
[Want to discuss? Get in touch with me @jamesreggio.]

When the keyboard is visible in SFSafariViewController, it becomes impossible to scroll to the bottom of the webpage. Naturally, this makes it difficult (if not impossible) to complete a form on the webpage, especially since the submit button typically appears towards the bottom of a webpage.

Steps to Reproduce:
1. Load the app referenced below *on a physical device*.
2. Tap the 'Bugs' tab bar item.
3. Tap the 'Content Inset + Keyboard Usability Bug' button.
4. *Do not scroll*, and immediately tap the 'First Name' field.
5. Now, try to scroll to the bottom of the webpage.

Expected Results:
The scrolling should be successful, and it should be possible to see the 'Subscribe Me!' button, as well as some padding below.

Actual Results:
It is impossible to scroll to the bottom of the form.

Version:
iOS 9.1 (13B137)

Notes:
The sample project is available on GitHub here:
https://github.com/jamesreggio/SFSafariViewControllerPlayground

Given the way keyboard emulation works in the simulators, I strongly recommend you reproduce and debug this on a physical device.

Furthermore, it's worth noting that these incorrect contentInsets can be reproduced without having to focus immediately on an input. Try loading the same webpage, scroll around a bit, then page focus on the 'First Name' field. It should be possible to scroll downwards to the end of the page; however, if you scroll upwards enough to collapse the navigation bar (with the page's URL hostname), the contentInsets will be set to an incorrect value again, and downward scrolling will cease to work.

In short, I think that there is a complex mal-interaction between the code you've written to cleverly collapse and expand the navigation bar, and the adjustments you make to the contentInset when the keyboard shows and hides.

Configuration:
iPhone 6 on iOS 9.1 (13B137)

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!