Closed sebilasse closed 3 years ago
Hey @sebilasse, thanks for raising the issue. I can’t seem to replicate the issue. Here’s a codesandbox, if you could change it to demo the issue that would be useful https://codesandbox.io/s/eloquent-wozniak-cm34j?file=/src/main.tsx
Tested the Sandbox in different browsers. The issue is in Safari 12.1.2 as described and with iOS Safari. iOS Safari does not allow to jump in the text …
Bug
In the Text-input widget, the caret jumps to the end if you want to add multiple characters in the middle of existing texts. The invalidation / rerender causes the caret to move to the end.
Package Version: current
Expected behavior: If I type 2
o
characters after the “Hello” inHello Dojo!
:Hellooo Dojo!
Actual behavior:
Helloo Dojo!o
Solution: Cache the caret position right before caching
value
in the nativeoninput
:icache.set('caret', [event.target.selectionStart, event.target.selectionEnd]);
Set it to undefined in
onblur
icache.set('caret', void 0);
In the beginning, apply it to the input field after validating: