iOS 9.2 (13C75): accepting QuickType prepends first typed character in HTML email

Originator:igeek1
Number:rdar://23920816 Date Originated:16-Dec-2015 11:49 AM
Status:Open Resolved:
Product:iOS Product Version:9.2 (13C75)
Classification:Serious Bug Reproducible:Always
 
Summary:
If you present an MFMailComposeViewController with HTML email content, in some circumstances, accepting QuickType suggestions causes the first letter of the typed word to be prepended to the accepted text in the body of the email.

Steps to Reproduce:
1. Open the attached sample project in the “fixable case” folder.
2. Run the app on a device. I’ve been using an iPhone 6s running iOS 9.2, but I’ve heard reports from iPhone 6 devices (not sure what iOS version they’re running).
3. Tap the Compose Mail button.
4. Edit the body of the email. Type some random characters, to the point where the QuickType bar above the iOS keyboard displays a word suggestion.
5. Tap a suggestion to use it.

Expected Results:
The random characters that you typed are replaced with the suggested word.

Actual Results:
The random characters that you typed are replaced with the suggested word, except that the first letter that you typed is still there. Example: if you type “Gnjfdh”, iOS suggests “Gnocchi”. If you tap “Gnocchi”, the text in the email now reads “GGnocchi” (notice the two leading G’s). It’s always the first letter _that you typed_, not the first letter _of the suggestion_, as you can see in the attached video.

Regression:
This has been a problem at lease since iOS 7, as documented in this Xamarin.org bug, which sadly never got filed as a Radar: https://bugzilla.xamarin.com/show_bug.cgi?id=23655

Notes:
In the “fixable case” project, removing the <head> tag and its contents from the HTML email body seems to resolve the problem. However, the “unfixable case” project contains a more complex HTML email body, which is from a recent client project (with all sensitive data scrubbed). Removing the <head> tag does NOT fix the issue in this case.

Also attached a screen recording of the bug being reproduced.

Attachments also uploaded here: http://cl.ly/e67H

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!