Pasting shouldn't end editing in UITextView

Originator:an00na
Number:rdar://32629175 Date Originated:June 7 2017, 5:24 PM
Status:DUPLICATE OF 32171312 OPEN Resolved:
Product:iOS + SDK Product Version:11
Classification:Serious Bug Reproducible:Always
 
Area:
UIKit

Summary:
In iOS 11 beta 1, pasting text into UITextView interrupt editing, more specifically:
1. It ends the current editing session: keyboard is dismissed, textViewShouldEndEditing and textViewDidEndEditing are called with UITextView.text being the old value.
2. textViewDidChange is called with the new value.
3. It begins a new editing session: keyboard is shown again, textViewShouldEndEditing and textViewDidEndEditing are called.

It shouldn't end the current editing session in the first place, not to mention the weird delegate call order— textViewDidChange being called in the between implies the text is changed non-interactively because it is out of any editing session.

Steps to Reproduce:
1. Launch sample app.
2. Tap the text to begin an editing session.
3. Select and copy the text.
4. Put cursor at the end.
5. Paste.
6. Pay attention to the keyboard and read the console logs.

Code: https://cloudup.com/cSFGitbKWHr

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!