Gutenberg-mobile: Deleting all contents of block moves cursor to last location in previous block

Created on 5 Mar 2019  Â·  5Comments  Â·  Source: wordpress-mobile/gutenberg-mobile

This happens on the Android app version alpha-155.

When deleting the content of a paragraph or heading block, as soon as the last letter has been deleted the block is deleted completely and the cursor moves into the block above it. Except, instead of appearing at the end of the block like you would expect when moving through content like that, the cursor jumps to wherever it was last located while it was in the block.

The result is that if you're holding down backspace, for example, you will delete the contents of the block you're in then suddenly start deleting the contents of the previous block but starting from a random position in the block.

Steps to reproduce:

  1. Create a new Gutenberg post with 2 simple paragraph blocks
  2. Put the cursor somewhere in the first block except its end
  3. Go to the end of the second block and start backspacing to delete characters. Delete up until the very first character of the second block
  4. Notice that the "Start writing" placeholder text appears
  5. After a small delay the focus moves to the first block. Sometimes the whole second block gets removed, some time is stays there. This step only happens on Android. On iOS, you need to backspace once more to cause the block merge.
  6. Notice the caret is placed at the position set in step 2
Writing Flow [OS] Android [OS] iOS [Type] Bug

All 5 comments

Thanks for reporting @hlashbrooke ! I managed to reproduce the issue and I've edited the ticket description to add steps.

The issue happens on iOS as well, expect for the step No5.

Oh - thanks for updating - those steps make it much more clear :)

Just adding some info, a recent PR by @pinarol has added the ability to set the caret position in some cases. Perhaps we can re-use that new feature or mimic it to place the caret at the end of the "previous" block.

cc @marecar3 since you're currently assigned on the ticket.

Ah thanks @hypest!!, I will try to re-use this logic.

Was this page helpful?
0 / 5 - 0 ratings