Different behaviors when pressing arrow keys after select all

scenario 1: Steps for reproducing:

  1. load https://prosemirror.net/
  2. select entire content (use ctrl+a to select it or using the mouse)
  3. press left-arrow/right-arrow key

Behavior: the cursor is placed at the beginning or at the end of the current document

scenario 2: Steps for reproducing:

  1. load https://prosemirror.net/
  2. select entire content (use ctrl+a to select it or using the mouse)
  3. press up-arrow/down-arrow key

Behaviors:

a. nothing happens if you used ctrl+al to select

b. the cursor is placed at the beginning or at the end of the current document if you used the mouse to select the document content

Could be fixed those scenarios to have the same behavior?

This patch should fix that. (For bug reports, we have an issue tracker, by the way.)

Thank you for your response.

I tested the patch. The scenarios when press down-arrow key after select-all seem to be fixed, but cases when press up-arrow key have now a different, unexpected behavior: the cursor is placed at the beginning of the previous block node found before the last one.

Steps for reproducing:

  1. before select-all, cursor is placed at the end of the last line of the document.
  2. select all
  3. press up-arrow

result: the cursor is placed in front of the previous line, see attached pictures.

select_all after_press_arrow

Notes: it doesn’t matter where you place the cursor before the select-all is made.

Firefox appears to not have this problem. Looks like Chrome’s native cursor motion is doing something weird here. This patch works around that.

The workaround fixed indeed the problem. Thank you for solving this so quickly!

Great. I’ve published the updated code as prosemirror-view 1.17.6.

1 Like