Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input bound value leads to cursor jumping on every keystroke #138

Closed
littleStudent opened this issue Sep 3, 2018 · 7 comments
Closed

input bound value leads to cursor jumping on every keystroke #138

littleStudent opened this issue Sep 3, 2018 · 7 comments

Comments

@littleStudent
Copy link

littleStudent commented Sep 3, 2018

I have a bound input element. So the state property storing the value is bound back to the dom element. On every keystroke this leads to the cursor jumping to the end of the input.

SSCCCE: https://ellie-app.com/3dWX47DKWwPa1
Browser: Safari (macOS & iOS confirmed)

input-cursor-jumping

module Main exposing (main)

import Browser
import Html exposing (Html, input)
import Html.Attributes exposing (value)
import Html.Events exposing (onInput)

type Msg
    = OnInput String

main : Program () String Msg
main =
    Browser.sandbox
        { init = ""
        , view = \str -> input [ onInput OnInput, value str ] []
        , update = \(OnInput str) _ -> str
        }

@harrysarson
Copy link

harrysarson commented Sep 3, 2018

Note this only happens on Safari.

@norpan
Copy link

norpan commented Sep 3, 2018

Also see whatwg/html#2412

@jinjor
Copy link
Contributor

jinjor commented Sep 3, 2018

See also elm/html#174

@decioferreira
Copy link
Contributor

this relates to /issues/134 and /pull/135

@digitalsatori
Copy link

digitalsatori commented Sep 12, 2018

same problem here, the problem found only on input element, textarea is OK. Safari only.

elm_input_problem

@evancz
Copy link
Member

evancz commented Sep 12, 2018

Some core team folks reviewed #135, and they tell me it should fix this. Can do a patch soon.

@evancz evancz closed this as completed Sep 12, 2018
@lucamug
Copy link

lucamug commented Jun 23, 2020

To avoid confusion in case people hit this old issue:

It has been fixed in virtual-dom v.1.0.1 (https://github.com/elm/virtual-dom/releases/tag/1.0.1) released on Sep 13, 2018.

This is an Ellie for it: https://ellie-app.com/9d3gvnKDT2ra1

This issue is also mentioned in

#107
elm/html#105
elm/html#42
elm/html#62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants