iOS Keyboard Extension textDocumentProxy.selectedText truncation

Originator:johnofaustin
Number:rdar://FB7789012 Date Originated:6/25/2020
Status:open Resolved:
Product:iOS Keyboard Extensions Product Version:
Classification: Reproducible:yes
 
I've created a UIInputViewController subclass for a keyboard extension. According to the documentation, the textDocumentProxy.selectedText property should contain "The currently selected text in the document." However, in many cases, the selectedText property doesn't match what the user has selected in the UI.

For example:
-  type the following text into a notes field in the contacts app: "This is text0. This is text1. This is text2. This is text3. This is text4. This is text5. This is text6. This is text7. 1234567890bcdefghijklmnop"
- select the entire text
- read the contents of textDocumentsProxy.selectedText from the UIInputViewController of a keyboard extension

Actual results:
- the textDocumentProxy.selectedText property contains: "This is text0. This is text7. 1234567890bcdefghijklmnop"

Expected results:
- the textDocumentProxy.selectedText property contains the entire text:  "This is text0. This is text1. This is text2. This is text3. This is text4. This is text5. This is text6. This is text7. 1234567890bcdefghijklmnop"

This is reproducible on both iOS 13, and the first iOS 14 beta. It reproduces on simulators and iPhone hardware.

Because of this truncation, I can't reliably provide functionality such as adding quote marks to selected text.

Comments

Having the same issue. Please look into this

By yamiras.business at May 19, 2023, 1:10 p.m. (reply...)

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!