evancz/guide.elm-lang.org

Repl misbehaving in chrome for android version 78.0.3904.108

Opened this issue · 2 comments

When typing in repl the text cursor is not moving,and text is not visible.but the text can be selected.

android version:6.0
chrome 78.0.3904.108

Sample screenshot:

Context: typed "asdf", then press return key

image

I suspect this issue is related: substance/substance#982, i.e., the keyup / keydown event is emitting a different value in Desktop Chrome vs Android Chrome.

I noted that repl.js uses the "keydown" event in https://github.com/evancz/guide.elm-lang.org/blob/master/repl/src/Repl.elm

onKeyDown : Attribute Msg
onKeyDown =
  preventDefaultOn "keydown" <|
    D.map4 (\key alt ctrl meta -> ( Press key alt ctrl meta, not (alt || ctrl || meta) ))
      (D.field "key" D.string)
      (D.field "altKey" D.bool)
      (D.field "ctrlKey" D.bool)
      (D.field "metaKey" D.bool)

These are just my observations, I'm still an Elm beginner. What's curious is that the return key works, but the rest of the characters do not.

Also see https://bugs.chromium.org/p/chromium/issues/detail?id=118639. It seems the keydown / keyup events are broken in Android Chrome, and the bug is labeled WontFix. From the tracker:

The bottom line is that if you want your keyboard-knowledgeable web page to work with Chrome, you're going to have to be tolerant of IME's idiosyncrasies with regard to key-codes.