Selection.anchorNode returns the first node on ctrl+a in the contentEditable
Reported by
syed.ali...@pearson.com,
Dec 20 2016
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36 Steps to reproduce the problem: 1. place the cursor at the end of second line 2. press ctrl+a / cmd+a to select all the text 3. do not click anywhere on the html page, 3. open the chrome dev console and click inside the console window to see the log messages 4. click inside the content editable , do not click anywhere on the html page. this is done to retain the text selection inside, contentEditable What is the expected behavior? What went wrong? You can see the console messsages read (this is the first paragraph), instead of reading the second paragraph, when only the second line is selected, it says "this is the second paragraph", similar behavior is when u do it with the first line Did this work before? No Does this work in other browsers? N/A Chrome version: 54.0.2840.98 Channel: n/a OS Version: OS X 10.11.6 Flash Version: Shockwave Flash 24.0 r0
,
Dec 26 2016
,
Jan 12 2017
Since click changes selection so listen the event to just collect current selection is not
good practice.
Following code works fine.
<!DOCTYPE html>
<html lang="en">
<body>
<div id ="input1" style="width: 500px; height: 250px; border: 1px solid black" contenteditable="true">
<div>This is the first paragraph</div>
<div>This is the second paragraph</div>
</div>
<script>
input1.focus();
document.execCommand("SelectAll");
console.log(getSelection().anchorNode);
console.log(getSelection().focusNode);
</script>
</body>
</html>
,
Feb 7 2017
,
Oct 4 2017
,
Oct 4
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 5
|
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by hdodda@chromium.org
, Dec 21 2016Labels: M-57 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)