LoginSignup
2
0

More than 3 years have passed since last update.

Elmでinputフォームを使ったらiPhoneのsafariで入力が以前の文字も入力されてしまうバグが起きたメモ

Posted at

現象

inputでmodelの値を更新するフォームをElmで作ったところ、iphoneの場合に、 それまでの履歴が入力されてしまう現象が起きた。

  • 12と入力すると、112、123と入力すると1121123のようになる。
  • 半角空白をいれると一旦きれてまた同じ現象となる。(1121123 、1121123 1、1121123 112、...)
  • webやandroidでは発生しない。
  • textareaでは発生しない
input [value val, onInput toMsg]

以下のものと似たような状態。
https://github.com/elm/virtual-dom/issues/138

解決

discordで質問したところ、上記のissueやHtml.Events.Extra.onChangeをonInputの代わりに使う方法を教えていただいた。onChangeに変更したところ現象は発生しなくなった。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0