Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting all contents of block moves cursor to last location in previous block #699

Closed
hlashbrooke opened this issue Mar 5, 2019 · 5 comments · Fixed by WordPress/gutenberg#14820
Assignees
Milestone

Comments

@hlashbrooke
Copy link

hlashbrooke commented Mar 5, 2019

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
@hypest
Copy link
Contributor

hypest commented Mar 5, 2019

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

@hypest hypest added the [Type] Bug Something isn't working label Mar 5, 2019
@hypest hypest added this to the Future milestone Mar 5, 2019
@hypest
Copy link
Contributor

hypest commented Mar 5, 2019

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

@hlashbrooke
Copy link
Author

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

@marecar3 marecar3 self-assigned this Mar 11, 2019
@hypest
Copy link
Contributor

hypest commented Mar 14, 2019

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.

@marecar3
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants