Question

I have a webapp with a search box that returns incremental results in real-time. In other words, it searches again on each character typed or changed in the search string.

Now consider a Japanese user inputting a string using the system-level IME, such as that in Windows. The user begins inputting the kana とうきょう, the phonetic representation of "Tokyo". Even before he has converted, in other words while the input is still in "pre-conversion" (or "composition") mode (often indicated by underlining), the change events fire on each additional character entered, kicking off a new search. Then, the user converts to get 東京, and the search re-executes again with this new text. What I want is a way to know when the user is in conversion mode, and suppress searches until he has converted to the final string.

I've looked at the Input Method Editor API (http://www.w3.org/TR/2013/WD-ime-api-20130815/), which seems to do what I want, but as far as I can tell it is not implemented anywhere yet. It seems to be slated for IE11 (http://msdn.microsoft.com/en-us/library/ie/dn385696(v=vs.85).aspx).

Is there any way to access IME status with the current generation of browsers out there?

Was it helpful?

Solution

I discovered the compositionstart and compositionend events, which are well supported and do what I need. See http://mdn.beonex.com/en/DOM/CompositionEvent.html.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top