insertAtCaret
insertAtCaret copied to clipboard
Inserts text into wrong spot after hitting backspace in Chrome
Let's say I have this text in a textarea:
insert zipcode into your text
If I then use backspace to delete the word "zipcode" and insertAtCaret, it will insert like this:
insert into y85666our text
See, it still thinks the cursor is at it's old location. This only happens in Chrome.
Yep, I can replicate the issue but it's a bug of Chrome. I don't know how we can manage to fix it. Do you have any idea?
I really do not know how to do it programmatically within the context of your plugin, but conceptually it would be something like this: Detect if the user is in Chrome and keep track of any backspace presses. Then upon inserting the caret, count back the position by the amount of backspaces pressed and insert it there instead of the current spot. Something like that I guess.
Hi @alimovz,
It seems Chrome has fixed the bug and it's not an issue right now. I created a fiddle here and tested on Chrome(v114 - arm64). I couldn'r replicate the issue. I'm going to close this issue. If you can replicate and create a test case, please reopen it and let me know.