-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RNMobile] Fix dictation regression on iOS #49056
Conversation
b1acc0d
to
46f7468
Compare
Flaky tests detected in 274ecde17bce0b1a894698f785c7639b622a96cb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4429990923
|
fc5eacf
to
274ecde
Compare
a57db24
to
4321062
Compare
By confining the hack to iOS 16 or above, we fix an issue with dictation causing content loss in later versions of iOS.
isInsertingDictationResult = false | ||
self.text = self.text?.replacingOccurrences(of: objectPlaceholder, with: dictationText) | ||
if #available(iOS 16, *) { | ||
insertText(dictationText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, I had originally attempted to call super.insertDictationResult()
, so that we could rely on the default function, but this caused a crash.
} else { | ||
let objectPlaceholder = "\u{FFFC}" | ||
isInsertingDictationResult = false | ||
self.text = self.text?.replacingOccurrences(of: objectPlaceholder, with: dictationText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this @SiobhyB! I was able to test dictation successfully following the testing steps on this PR, and the other PRs mentioned, and did not note any content loss.
I did note the issue where multiline dictations do not expand the text input for each line until the user taps out of the block, as mentioned and described in your comment here, and also this video example from the same thread. I agree that your ideas to use isInsertingDictationResult
or textViewDidChange
would be a good approach to leverage in a later PR. Also, I did not run into the capitalization issue mentioned in that comment. 👍
LGTM! 🚀
Thank you so much @derekblank! 🙌
I'll create a separate GitHub issue for this so we don't lose track and it can be tackled in later PRs, as you suggested 🙇♀️ |
Proposed fix for wordpress-mobile/gutenberg-mobile#5165
Gutenberg Mobile
: Fix dictation regression on iOS wordpress-mobile/gutenberg-mobile#5561WordPress iOS
: [DO NOT MERGE] Fix dictation regression on iOS wordpress-mobile/WordPress-iOS#20335What?
The changes in this PR fixes an issue with dictation not working as expected on devices running iOS 16 or later. To achieve this, an old dictation-related hack has been removed for later iOS version.
Why?
The dictation hack stopped being necessary following improvements made to dictation in iOS 16.
Now, with devices that are running iOS 16 or later, text added with iOS dictation is lost when tapping into the editor or typing while the dictation is still recording. This causes unexpected content loss, and could be viewed as an accessibility issue for those who rely on dictation to use the editor.
How?
The hack that was first introduced in wordpress-mobile/gutenberg-mobile#610 has been confined to only run for older versions of iOS 16.
It's necessary to keep this in place for older versions.⤵️
If we remove the hack for older versions, an
obj
symbol is generated when dictating, as reported in wordpress-mobile/gutenberg-mobile#1969. Screenshot taken from an iPhone 6s (iOS 15.5) emulator with the hack removed:You can refer to the comment section of wordpress-mobile/gutenberg-mobile#5165 for further context on how this solution came about.
Testing Instructions
An installable build is available at wordpress-mobile/WordPress-iOS#20335 for testing on a physical device.
The following steps need to be tested with both iOS 16 or later and an earlier version of iOS:
It would also be helpful to go through the testing steps in the following PRs, where the hacks were originally introduced, to ensure there are no similar issues now they've been removed:
Screenshots or screencast
Screen.Recording.2023-03-15.at.20.29.08.mov