I implement a custom keyboard extension. On modern iPhones the dictation button will display in the lower right even when a custom keyboard is active. If you are in an empty text field with the sentence capitalization trait turned on (e.g., Messages), press the Mic button, and dictate something, it will appear with the first word capitalized. As it should. But when you hit the Mic button again to accept the result, the first word is suddenly changed to uncapitalized. With the system keyboard this final case change does not occur.
Why? How to prevent this?
More technical detail: I receive UITextInputDelegate-textWillChange and UITextInputDelegate-textDidChange events during dictation (always with the textInput parameter set to nil) and then a final textDidChange with the lowercased text when accepting at the end.