Problem/Motivation

Typing with an IME (for CJK characters), it needs user key in few keystrokes to compose a character.

The Autocomplete in D8 attached INPUT event to listen to every keystroke you typed and send keystrokes to the remote server to receive prediction.

For example, to compose the Traditional Chinese character "LIKE", you will key in "yrhuc". The remote server receives "Y" and send back Y-prefix prediction. This is a bad UX and causes extra network overhead to the remote server

Screenshot from #7

Before:
Before

After:
After

Proposed resolution

To suppress this behavior, the patch uses CompositionEvent to handle IME input. It will only send the compostion text to form INPUTs to match the prefix in the remote server.

Remaining tasks

- Manual Testing @see #7
- Code Review

User interface changes

- No Changes
- (Reducing network requests in background)

API changes

- Added `compositionstart.autocomplete` event listener
- Added `compositionend.autocomplete` event listener

Data model changes

- N/A

CommentFileSizeAuthor
#7 after.gif319.81 KBjungle
#7 before.gif245.13 KBjungle
#4 demo.gif115.48 KBjungle
ime-input.patch1.46 KBdroplet
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

droplet created an issue. See original summary.

mgifford’s picture

Issue tags: +i18n

I had no idea what CJK stood for.

What's the easiest way to test this for users who don't speak that set of languages?

droplet’s picture

Mac User:
https://support.apple.com/kb/PH18448?locale=en_US

You can add Chinese, Traditional: Cangjie.

Windows 10 User:
https://www.youtube.com/watch?v=9UrVkP1q-Do

Mobile User (either iOS or Android):
Go to Keyboard and add a new keyboard: Chinese, Japanese ..etc

Random press a key or two and then use 1-9 to select a character (if no responses, try to press SPACE)

Technical info about IME if anyone interested:
https://developer.mozilla.org/en-US/docs/Mozilla/IME_handling_guide

jungle’s picture

FileSize
115.48 KB

Hi @mgifford, an animation added for illustrating this problem.

I typed niSPACEhaoSPACE in the demo.

BTW, 你好 means hello in Simplified Chinese, and the input method I used is Sogou Input downloaded here

droplet’s picture

@jungle

You're the right person to review this patch :)

jungle’s picture

Assigned: Unassigned » jungle
jungle’s picture

FileSize
245.13 KB
319.81 KB

The patch works for me.

Thanks @mgifford & @droplet!

Before:

Before

After:

After

jungle’s picture

Assigned: jungle » Unassigned
droplet’s picture

Issue summary: View changes

Thanks @jungle. We can see the huge improvement in above GIF.

Needs a reviewer for the code part.

nod_’s picture

Status: Needs review » Reviewed & tested by the community

Code is ok for me.

  • catch committed 528e126 on 8.3.x
    Issue #2823589 by droplet, jungle: Improve IME handling on Autocomplete
    

  • catch committed 03d13a4 on 8.2.x
    Issue #2823589 by droplet, jungle: Improve IME handling on Autocomplete...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.