elm-community / html-extra

Additional functions for working with Html.
http://package.elm-lang.org/packages/elm-community/html-extra/latest
MIT License
31 stars 14 forks source link

Use keypress instead of keyup in onEnter #12

Open jinjor opened 6 years ago

jinjor commented 6 years ago

This is a problem specific to a particular situation.

Japanese text are input by pressing Enter key twice.

  1. Choose correct letters
  2. Finish editing

The problem is that onEnter handles event on the timing (1) instead of (2).

For example, when we Japanese type kansuu, there are many way to express it. (1) Show kansuu directly (2) convert to かんすう (3) convert to 関数 (4) convert to 巻数... This functionality is called IME (Input Method Editor).

screen shot 2018-01-27 at 23 10 15

When we want to input "関数って最高だよね", we first type kansuu and then choose 関数 using Enter key. Now we haven't finished inputting the whole text yet, but onEnter event is unexpectedly emitted.

As far as I know, using keypress instead of keyup solves this problem. But I'm not sure if this change causes any downside or not. I will really appreciate if someone could review this.