Skip to content

Forward iOS keyboard composition as Winit IME events - #4836

Open
petralithic wants to merge 3 commits into
rust-windowing:masterfrom
petralithic:fix/ios-keyboard-composition-2026-11-12
Open

petralithic wants to merge 3 commits into
rust-windowing:masterfrom
petralithic:fix/ios-keyboard-composition-2026-11-12

Conversation

@petralithic

Copy link
Copy Markdown

Why this is needed

The iOS Winit view handles basic text insertion and deletion through
UIKeyInput. Apps that enable the IME still lack provisional text and
candidate selection events when people type with keyboards such as Japanese
Kana. This follows the basic iOS support introduced in #3823.

Change

Use a UIKit text field as the software keyboard's first responder while the
IME is enabled. Report its marked text and UTF-8 caret positions as Winit
preedit events, and forward the selected candidate as a commit. Preserve the
ordinary key path for text and deletion outside composition.

Verification

  • On an iPhone 17 simulator running iOS 27, XCTest tapped か and な on
    Apple's Kana keyboard, verified provisional かな, then tapped 仮名 in
    the native candidate bar. The app cleared its preedit and committed
    仮名 once. The native delete key then left 仮.

  • Nightly formatting, Winit core tests, strict UIKit Clippy, the UIKit
    simulator test build, Winit's CI documentation command, and the ARM64 iOS
    device-target build passed.

  • An additional direct UIKit rustdoc run with warnings denied found two
    unresolved links already present on the upstream base.

  • Tested on all platforms changed

  • Added an entry to the changelog module if knowledge of this change could
    be valuable to users

  • Updated documentation to reflect any user-facing changes, including
    notes of platform-specific behavior

  • Created or updated an example program if it would help users understand
    this functionality

The standalone simulator fixture verifies the existing Winit IME API.

@petralithic
petralithic requested a review from madsmtm as a code owner November 12, 2026 21:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant