Enable IME for text inputs focussed before first layout - #843
Open
nicoburns wants to merge 1 commit into
Open
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With a CJK input source active, typing into an input that is focussed at startup (
autofocus, oronmounted → set_focus) produced raw ASCII until the input was blurred and re-focussed.Cause:
Node::focusdecided "is this a text input?" viaelement_data().text_input_data().is_some(), butTextInputDatais only created during layout construction (create_text_editorinlayout/construct.rs). Autofocus runs at mutation-flush time, before the firstresolve(), soset_ime_enabled(true)was never called.Changes (
blitz-dom):ElementData::is_text_input()— tag/type-based check (same set asconstruct.rs), independent of layout.Node::focus/blurnow use it to enable/disable the IME.Node::ime_cursor_area() -> Option<(x, y, w, h)>returnsNonebefore layout instead of reading a not-yet-computedfinal_layout.BaseDocument::sync_ime_cursor_area()is called at the end ofresolve()after layout: it reports the focussed text input's content box to the shell, deduplicated againstlast_ime_cursor_areaso it only fires when the area actually changes (including after the first layout of an autofocussed input, or when the input moves due to relayout).Adds a unit test with a recording
ShellProvidercovering focus-before-layout →set_ime_enabled(true), area reported once afterresolve, no re-report on unchanged layout, andset_ime_enabled(false)on blur.Found during the macOS smoke test of #614 (pre-existing on
main). On macOS the cursor area is currently still discarded by winit because Blitz enables the IME without thecursor_areacapability; that is fixed in a separate PR.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/a737411590c54bbb833aa9167f89ac51
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/a737411590c54bbb833aa9167f89ac51?variant=devin-insiders
Requested by: @nicoburns
WPT results
No changes in test results compared to
main.Generated by the WPT workflow.