Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[iOS 16] Previously dictated input is inserted in next field when cha…
…nging focused element https://bugs.webkit.org/show_bug.cgi?id=241751 rdar://84995538 Reviewed by Megan Gardner. When changing focus between text fields while continuous dictation is active, dictated text in the previously focused text field is inserted in the newly focused field. This happens because UIKit attempts to update the dictation string one final time prior to changing the keyboard input delegate; however, this doesn't work in `WKWebView`, due to the fact that the previous field has already been blurred by the time we handle element focus and reload input views in the UI process. Mitigate this by treating `-replaceDictatedText:withText:` and `-insertText:` as no-ops in the case where they are triggered while hiding the keyboard; note that this only changes behavior in cases where UIKit would've otherwise inserted or modified text in newly focused elements, while only having text input and autocorrection context from the previously focused element -- as such, it's very unlikely that any (intended) platform editing behaviors in WebKit2 depend on the ability to insert text in this specific scenario. * Source/WebKit/UIProcess/ios/WKContentViewInteraction.h: Add a new `_isHidingKeyboard` flag. * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView replaceDictatedText:withText:]): (-[WKContentView insertText:]): (-[WKContentView _hideKeyboard]): Set `_isHidingKeyboard` during the scope of this method call. Canonical link: https://commits.webkit.org/251694@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information