Status: Unconfirmed
Owner: ----
Labels: Cr-Blink Pri-2 Via-Wizard Type-Bug OS-Mac
New issue 526516 by
antonio....@gmail.com: <textarea> selectionStart always
returns 0 in focus event
https://code.google.com/p/chromium/issues/detail?id=526516
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
Example URL:
Steps to reproduce the problem:
1. Copy the HTML below
2. Write in the <textarea> and move the cursor in the middle of the text
3. Click the button Focus and see that 0 is logged in the console
<textarea id="text"></textarea>
<button onclick="document.getElementById('text').focus();">Focus</button>
<script>
var textarea = document.getElementById('text');
textarea.addEventListener('focus', function (e) {
console.log(textarea.selectionStart);
});
</script>
What is the expected behavior?
The textarea.selectionStart should return the cursor position not zero. In
every other page state it returns the correct value.
P.S.: The problem could also be replicated for the selectionEnd property.
What went wrong?
The console prints 0 because textarea.selectionStart is incorrect.
Does it occur on multiple sites: Yes
Is it a problem with a plugin? No
Did this work before? N/A
Does this work in other browsers? Yes
Chrome version: 44.0.2403.157 Channel: stable
OS Version: OS X 10.9.5
Flash Version: Shockwave Flash 18.0 r0
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings