Input Method Editor API
Internet Explorer 11 introduces a set of APIs that enable web applications to provide a better Input Method Editor (IME) input experience. For example, the IME API provides composition information for auto-complete or search suggestions, and enables you to avoid user interface collisions between an IME candidate window and a search suggestion list.
The IE11 implementation is based off Microsoft's IME API proposal to the World Wide Web Consortium (W3C). Full support of this feature is available when using the native Windows 8.1 IMEs, including those available to Internet Explorer in the new Windows UI and Windows Store apps using JavaScript. Partial support is available to Internet Explorer for the desktop in Windows 8.1 and Windows 7. In these cases, IMEs for certain languages might not support all of the APIs listed here.
The MSInputMethodContext object
The MSInputMethodContext represents IME functionality for a single element and provides information about the current status of IME composition. Use the msGetInputMethodContext method to obtain the MSInputMethodContext for a given element:
var testElement = document.getElementById("test");
var testElementIMEContext = testElement.msGetInputContext();
You can register handlers for the following MSInputMethodContext events:
Event | Description |
---|---|
Fires immediately after the IME candidate window is set to appear, but before it renders. |
|
Fires after the IME candidate window has been identified as needing to change size, but before any visual updates have rendered. |
|
Fires after the IME candidate window is fully hidden. |
The MSInputMethodContext object has the following properties:
Property | Description |
---|---|
Returns the element associated with the MSInputMethodContext. |
|
Returns the starting offset (character position) of the composition relative to the target if a composition is occurring, or zero if there is no composition in progress. |
|
Returns the ending offset (character position) of the composition relative to the target if a composition is occurring, or zero if there is no composition in progress. |
The MSInputMethodContext object supports the following methods:
Method | Description |
---|---|
Returns true if there is a composition in progress, and false otherwise. |
|
Returns a copy of the current list of alternate candidate strings from the MSInputMethodContext object. |
|
Returns true if the IME candidate window UI is visible, and false otherwise. |
|
Returns a ClientRect object with candidate window coordinate space information (if the IME candidate window is visible). |
CSS support
Additionally, IE11 introduces a new CSS property for controlling the alignment of the IME candidate window:
Property | Description |
---|---|
Aligns the IME candidate window box relative to the element on which the IME composition is active. The following values are supported:
|
IEBlog posts
Building Better Input Experience for East Asian Users with the IME API in IE11