Cannot select text in content resolution in Chrome using keyboard

In Chrome, I cannot select the contextual context of the text using the keyboard in Chrome when the text contains a long line that wraps to the next line.

This is playback in Chrome (last, Chrome 47 at the time of my writing).

Repro Steps

  • Click to place the cursor at the end of the contentedtable div (in the snippet below).
  • Hold shift and press the up arrow several times.

Expected : all text will be selected.

Complied with : the text in front of the space ("foo") is never selected.

Here is the code. NOTE the character after "foo" is a space, not a newline!

<div contenteditable="true" style="background: #ddd; width: 200px; height: 100px;">foo asdfjkl;asdfjkl;asdfjkl;asdfjkl;asdfjkl;asdfjkl;asdfjkl;</div> 
+7
html html5 google-chrome contenteditable
source share
1 answer

Actually, the correct behavior of text fields in general.

In this case, you see two words on different lines, because the second one is larger than the container, so you see a line break, and you are trying to use up arrow to select "foo".

But, as you say in the question, there is a white space after "foo", so you should use the left arrow to select it.

Imagine the same case, but with a full width text box, you will only try to use the left arrow . Here, only the style is changed, not the behavior for this particular content.

+1
source share

All Articles