Maybe this will be helpful for you:

https://github.com/evancz/elm-html/pull/81#issuecomment-236994878

>I believe the problem observed in the examples is with a selection instead 
as when you modify the input.value it changes input.selectionStart and 
input.selectionEnd to the end of the value. So what you you observe is when 
you change cursor position your model and actual DOM state gets out of sync 
as a side effect of actually not keeping track of selection ranges.

In the project I work we resolved similar issues with input.value by 
starting to model selection in the input along with value. That way when 
you update a value you also update cursor position back to it's original 
and there for avoid getting out of sync with actual DOM. Please note that 
there are many crucial details on when to update selection and not to 
update it when it already matches the selection in the input to avoid other 
races, but given the interest I'm happy to share more details.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to