[wp-trac] [WordPress Trac] #45371: Add tag: Use `event.isComposing` to support input method editor (IME) converters
WordPress Trac
noreply at wordpress.org
Sun Nov 18 16:41:39 UTC 2018
#45371: Add tag: Use `event.isComposing` to support input method editor (IME)
converters
---------------------------+-----------------------------
Reporter: afercia | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: 4.9
Severity: normal | Keywords:
Focuses: accessibility |
---------------------------+-----------------------------
In some languages, for example Chinese, Japanese, and Korean, Input Method
Editor (IME) converters are used to show a list of suggestions and pick up
an alternate script, for example
[https://en.wikipedia.org/wiki/Japanese_input_methods theJapanese kanji].
In #42234 / [41988] the `keyup` event used to insert a Tag was changed to
`keypress` to support IME converters. However, this change broke the
previous keyboard interaction for users who don't use an IME. See also
#42233.
There are now 2 keypress events on the same input but more importantly
there's now the need to press the Enter key twice to add a term.
Previously, one Enter key press was enough because the term was added
''when releasing'' the Enter key (on keyup).
The different keyboard interaction behavior can be easily verified testing
the previous behavior on WordPress 4.8 and the new one on WordPress 4.9.
Worth noting this also affects the way the associated `speak()` audible
messages work.
Thanks to @miyauchi who pointed it out and thanks to the remarkable
collaboration on this Gutenberg Pull Request
https://github.com/WordPress/gutenberg/pull/11908 it appears there's now a
better method to balance the two different needs.
By using `event.isComposing` it's possible to detect when characters are
being composed and wait for the composition to end before triggering a
callback. This way, it should be possible to restore the previous behavior
for non-IME users (just one Enter key press to add a tag) and also support
IME users.
Also, this would align with what Gutenberg already does.
A couple references:
Browsers support: https://developer.mozilla.org/en-
US/docs/Web/API/KeyboardEvent/isComposing#Browser_compatibility
More details: https://www.w3.org/TR/uievents/#events-composition-types
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45371>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list