Shift+Arrowkey text selection bug between two paragraphs


#1

When selecting some text using shift+arrowkey one extra step has to be taken. Meaning the arrowkey has to be pressed one extra time. In the gif I try to show that problem. You can see the square-button (select paragraph-button) disappearing when doing that extra step.

Is this behaviour wanted or is this a bug?


#2

I think this makes sense—before, the head of your selection is still in the upper paragraph, at its very end. After pressing once more, it moves to the start of the lower paragraph, at its start. TinyMCE and raw contentEditable show this same behavior.


#3

Hey, it’s me again, I came along another problem. It’s quite similar but not exactly the same. If I insert a hard-break shift-enter the arrow-key-navigation over it very weird. It blocks a movement to the right completely, while a movement to the left works the way it should. Selections over a hard-break while holding the shift-key down need one more press on the arrow key than I would expect they need.


#4

In which browser are you testing? And in your expectation, are you taking the fact that the hard break node also needs to be selected (accounting for one arrow key press) into consideration?


#5

I’m testing in google chrome. Considering the hard break node selection is different to the newline I understand now that there is one more arrow key press needed. Still, navigation with only the right-arrow-key (without holding shift) over a hard-break is blocked completely. Navigation with the left-arrow-key works though.


#6

I can reproduce the right-arrow issue on Chrome (but not Firefox). I’ve opened #755 for that.


#7

Ok, back to the shift-arrow-key: When saying the hard break node also needs to be selected, did you mean the “the hard break node also needs to be selected in addition to the newline” or did you think of the hard break node being the newline? The behaviour that I can see right now is that it takes one extra step for the hard-break node to be selected and one extra step for the newline to be selected. Shouldn’t the hard break node itself already be the newline?


#8

The hard break is the newline, so no, you don’t need to select them differently. Testing on Chrome with the current code, I’m seeing both shift-left-arrow and shift-right-arrow selection work as I’d expect—one press is needed to select the break, the others select characters around it.


#9

Hm, are you sure you are testing this with a hard break (shift-enter-break)? For me it looks like there would be a newline after the hard break which is selected in addition the hard break itself. For example shift-navigation to the right would select the last letter in the line, then the hard-break, then the newline, then the first letter of the next line.