Issue metadata
Sign in to add a comment
|
Texarea cursor positon is incorrect when delete, click away, re-focus with JS.
Reported by
tine...@gmail.com,
Jun 18 2017
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Steps to reproduce the problem:
1. Type some text into a textarea. (Or place cursor in textarea that already has text.)
2. End with one or more deletes in the middle of some text.
3. Blur by clicking away.
4. Using javascript, focus the textarea again.
<!DOCTYPE html>
<html><body>
<textarea id = "ta">Place cursor somewhere (not at the end) and press delete.</textarea><br/>
<button id = "button" onClick="button_clicked();">then click me</button>
<div>Compare the cursor position before and after clicking the button.
<script>
function button_clicked(){
document.getElementById("ta").focus();
}
</script>
</body></html>
What is the expected behavior?
The cursor should be in the same location as before clicking away.
This works correctly in both IE and Firefox.
What went wrong?
The cursor is in the wrong position. It has jumped forward by however many times delete was pressed before clicking away from the textarea.
Did this work before? Yes Not sure, but am only hearing about this issue from my users now.
Does this work in other browsers? Yes
Chrome version: 58.0.3029.110 Channel: n/a
OS Version: 10.0
Flash Version:
Why this matters: I use this to programmatically enter text (such as special characters and symbols) at the cursor's location when the user clicks a button. Chrome is now inserting the text at the wrong location if the user has just used delete.
,
Jun 18 2017
Chrome 58 is a previous version of Chrome Stable. Please test with the latest version before filing an issue.
,
Jun 19 2017
It works correctly in version 59 :) |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by tine...@gmail.com
, Jun 18 2017