iOS 10 beta: UIWebView: can't change text size on iPad

Originator:skyriser
Number:rdar://27201529 Date Originated:2015.07.06
Status:Closed Resolved:2016.11.02
Product:iOS 10 Product Version:
Classification: Reproducible:
 
Using Xcode 8 beta 2, on iPad simulator with iOS 10 beta (14A5297c)

See sample project and screenshots for references.


In our production app, we can't seem to be able to change the text size of a UIWebView on iOS 10 on iPad.

We're using this method to change the text size:
[self.webview stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust = '%d%%'", size]];


Running sample project, always running on iPad simulator with iOS 10, by clicking the "Bigger" and "Smaller" buttons to change the text size:
(always running in iPad simulator, but switching Deployment device setting)
-On iOS9, built for iPhone device: works
-On iOS9, built for iPad device: works
-On iOS10, built for iPhone device: works
-On iOS10, built for iPad device: DOESN'T WORK, no resizing, no errors or warnings


For the sample project, to switch between building for iPad or iPhone in the sample project, change the Deployment Info "Device" project settings.

We are aware of WKWebView, and there are similar issues, using similar methods, except that it doesn't work for both iPad and iPhone on iOS10, but works on iOS9.


Tried with iOS beta 1 and iOS beta 2 with same results.

Comments

Still fixed in iOS10.2b2 :)

Looks fixed in iOS10.2b1! I'll keep testing to confirm.

Still broken in iOS 10.1GM.

Fixed here on WebKit trunk:

Bug 162227: REGRESSION (r201090): Setting style.webkitTextSizeAdjust does not change text change on iPad

https://bugs.webkit.org/show_bug.cgi?id=162227

http://trac.webkit.org/changeset/206217

We is aware that this is a regression in iOS 10 and that developers would like a fix soon.

Thanks for the update ddkilzer, looking forward to the fix :)

Still broken in iOS 10.1b4.

Still broken in iOS 10.1b3.

Still broken in iOS 10.1b2.

Thanks @ddkilzer! Please let us know if have any idea which iOS version this will be included in.

This bug tracks the fix in open source WebKit:

REGRESSION (r201090): Setting style.webkitTextSizeAdjust does not change text change on iPad

https://bugs.webkit.org/show_bug.cgi?id=162227

Workarounds (private APIs)

I've found workarounds involving private APIs.

UIWebView:

[[[webView.scrollView.subviews.firstObject webView] preferences] _setTextAutosizingEnabled:YES];

WKWebView:

[webView.configuration.preferences _setTextAutosizingEnabled:YES];

If you'd like to submit to AppStore, take some precautions like using performSelector:, NSSelectorFromString() and so on.

Still broken in iOS 10.1 b1.

Still broken in iOS10 GM.

Apple Please Fix this ASAP

This is a big issue that was reported early in the beta. Why isn't it fixed?

Still broken in iOS10b8.

Note: In the Safari inspector, with the same code/project running in the simulator, the iPhone is modified correctly ("-webkit-text-size-adjust: 220%;"), but not on iPad ("-webkit-text-size-adjust: auto;").

Still broken in iOS10b3.

Maybe related?

http://stackoverflow.com/questions/37808180/disable-viewport-zooming-ios-10-safari

"From the iOS 10 beta 1 release notes: To improve accessibility on websites in Safari, users can now pinch-to-zoom even when a website sets user-scalable=no in the viewport."

Also created forums discussion: https://forums.developer.apple.com/message/151610#151610


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!