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:

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
Comments
Comment #2
mgiffordI 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?
Comment #3
droplet commentedMac 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
Comment #4
jungleHi @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
Comment #5
droplet commented@jungle
You're the right person to review this patch :)
Comment #6
jungleComment #7
jungleThe patch works for me.
Thanks @mgifford & @droplet!
Before:
After:
Comment #8
jungleComment #9
droplet commentedThanks @jungle. We can see the huge improvement in above GIF.
Needs a reviewer for the code part.
Comment #10
nod_Code is ok for me.
Comment #13
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!