Test case:
cargo make start counterclick - place cursor somewhere before the last letter, e.g. c|lick x) and observe - you should see cxlick|I tried to reset master branch before we merged sync with animation frame but it seems that this bug was here from the beginning.
I was googling a little bit and it seems that every second person encountered this - jQuery, React, plain js..
I'll try to fix it somehow.
I investigated it a little bit, see referenced PR #159 for more info.
@David-OConnor I don't want to change code under your hands and I think that it will we more effective when you fix it while you are refatoctoring events & listeners.
@David-OConnor Do you have something in progress or can I fix it?
Have at it - Nothing on my end.
Bug seems to be fixed on desktop browsers (Firefox + Chrome on Windows), but it still jumps on iOS (Safari + Firefox). You can test it with https://seed-rs-realworld.netlify.com/ (for example on Sign-in form).
Possible solution is to remember cursor position before calling set_value and then set it to previous value (inspired by https://github.com/facebook/react/issues/955#issuecomment-469344232).
Or we can experiment with orders.force_render.
P.S. @David-OConnor I will be without PC for about two weeks in August, so I can't start working on it until the second half of August.
That RWE looks great!
Update:
Can't use solution in https://github.com/facebook/react/issues/955#issuecomment-469344232 now, because it's blocked by https://github.com/rustwasm/wasm-bindgen/pull/1811.
Once this PR is merged and a new wasm-bindgen (web-sys) is released, we can continue to implement it probably here: https://github.com/David-OConnor/seed/blob/291c6392b452b99f56fc6a8095a42313c32dba5e/src/util.rs#L108 We have to be careful with implementation for HTMLInputElement because only some types support selectionStart/End - see table https://html.spec.whatwg.org/multipage/input.html#concept-input-apply.
How to test it:
cargo make start counter 192.168.x.x:8000Update: PR merged, next web-sys version (> 0.3.28) should unblock implementation
Update: wasm-bindgen with required HTMLInputElement methods has been released: https://github.com/rustwasm/wasm-bindgen/releases/tag/0.2.52
Most helpful comment
That RWE looks great!