Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec004b440d887772ccf6b4b7a5f57a75cf317cf8
      
https://github.com/WebKit/WebKit/commit/ec004b440d887772ccf6b4b7a5f57a75cf317cf8
  Author: Sammy Gill <[email protected]>
  Date:   2026-06-29 (Mon, 29 Jun 2026)

  Changed paths:
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Tools/Scripts/webkitpy/api_tests/allowlist.txt
    M 
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/UIWKInteractionViewProtocol.mm

  Log Message:
  -----------
  x.com: Software keyboard delete key is unresponsive after using dictation
https://bugs.webkit.org/show_bug.cgi?id=317864
rdar://163454428

Reviewed by Wenson Hsieh.

Make replaceDictatedText use Editor::setComposition instead of
Editor::insertText so that dictation streaming is tracked as a
composition. This means JS frameworks (draft.js, ProseMirror, etc.)
see compositionstart/compositionupdate/compositionend events instead of
plain insertText, allowing them to defer DOM reconciliation during
dictation.

This is needed to fix a bug on x.com where dictating to compose a new
post would result in the backspace no longer working. This is because
the mutations that are occurring to update the text are changing the DOM
underneath draft.js in a way that ends up putting them in a bad state.
It does look like draft.js listens for composition events and even
creates a MutationObserver at the start of the composition. By doing
this it allows them to recover and put the DOM back in the state they
want which allows the backspace to work. It also looks like other
engines on other platforms do the same thing so this also brings us
closer to interoperability.

On the first replaceDictatedText call (no existing composition), we find
the initial text that was inserted earlier from a call to insertText,
select it, delete it with deleteSelectionWithSmartDelete, then start a
composition via setComposition. On subsequent calls, setComposition
internally selects and replaces the existing composition via 
selectComposition().
When newText is empty and there is no composition, we just delete the
previously dictated text and return, avoiding a spurious compositionend.

Canonical link: https://commits.webkit.org/316049@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to