Skip to content
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

web: Implement basic IME #19896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Mar 23, 2025

Basically, if we ignore composing input events, we can just accept the final composed text as key presses (not as text composition).

This is the first step towards implementing IME on web.

IME mechanics are not being used, no preview is available, but inserting text with IME should work.

@kjarosh kjarosh added A-web Area: Web & Extensions text Issues relating to text rendering/input input Issues relating to user input in Flash content T-compat Type: Compatibility with Flash Player ime Issues related to Input Method Editor labels Mar 23, 2025
@kjarosh kjarosh added the waiting-on-review Waiting on review from a Ruffle team member label Mar 23, 2025
@danielhjacobs
Copy link
Contributor

This isn't working on Android when I try to type in an EditText with the virtual keyboard.

@danielhjacobs
Copy link
Contributor

A virtual keyboard like the one on Android isComposing.

@danielhjacobs
Copy link
Contributor

To explain the current logic, which I guess may need comments.

  1. If you type a single character using the virtual keyboard, that character fires a keydown and then keyup event into the focused EditText.
  2. If you backspace or delete a single character using the virtual keyboard, that backspace/delete fires a keydown and then keyup event into the focused EditText.
  3. If you paste a string using the virtual keyboard, each character in that string in sequence fires a keydown and then keyup event into the focused EditText.

@danielhjacobs
Copy link
Contributor

I'm guessing the IME logic can be used to support this more properly, but landing this PR without IME support would regress the virtual keyboard.

@danielhjacobs
Copy link
Contributor

danielhjacobs commented Mar 24, 2025

Maybe we can do exactly this but also keydown and keyup the event.data character(s) on compositionend.

@kjarosh kjarosh force-pushed the web-basic-ime branch 2 times, most recently from a00d15d to 2af747a Compare March 29, 2025 21:07
@kjarosh
Copy link
Member Author

kjarosh commented Mar 29, 2025

@danielhjacobs can you check if the current code works properly? It does for me

@danielhjacobs
Copy link
Contributor

Tried with GBoard and it worked perfectly. With Samsung Keyboard it's unfortunately a different story, see recording.

Screen_Recording_20250329_171917_Chrome.online-video-cutter.com.mp4

@kjarosh
Copy link
Member Author

kjarosh commented Mar 29, 2025

It seems that this keyboard uses IME for inputting all text. Without implementing IME on web we cannot have both IME preview and IME input working :/ This PR breaks IME preview, but fixes IME input.

@kjarosh kjarosh changed the title web: Ignore IME composing events when inputting text web: Implement basic IME Mar 30, 2025
This patch implements IME preediting and committing on web. It does not
implement moving the cursor and proper positioning yet.
@kjarosh
Copy link
Member Author

kjarosh commented Mar 30, 2025

Okay, as IME on web is a mess, I've decided to implement basic IME mechanics (including preediting) on web.

@danielhjacobs @n0samu You can test it out here: https://kjarosh.github.io/ruffle/pr19896/

@kjarosh kjarosh added A-input Area: Input handling and removed A-web Area: Web & Extensions input Issues relating to user input in Flash content labels Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-input Area: Input handling ime Issues related to Input Method Editor newsworthy T-compat Type: Compatibility with Flash Player text Issues relating to text rendering/input waiting-on-review Waiting on review from a Ruffle team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants