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

Delete at the beginning of newly created quote deletes the quote, not the first charater. #35388

Closed
tomalec opened this issue Oct 6, 2021 · 2 comments · Fixed by #60858
Closed
Assignees
Labels
[Block] Quote Affects the Quote Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@tomalec
Copy link
Contributor

tomalec commented Oct 6, 2021

Description

I convert a paragraph of text (pasted markdown, or just any text) to a quote block, by adding > at the beginning. Then once the block is converted, I continue expecting the block would behave as if it has been before, and I placed the caret at the beginning. So I press del I'd expect the first character after the caret to be removed.

Then unexpectedly the quote block is converted back to a paragraph. This is the action I'd expect on undo or backspace. del deletes what's after not before the caret.

In Notion and other rich text editors, it behaves as I'd expect.

Step-by-step reproduction instructions

  1. Open the editor, like https://wordpress.org/gutenberg/
  2. Move caret to the beginning of a paragraph.
  3. Type > .
  4. Once the block is converted press press del.
  5. Continue typing.the

Screenshots, screen recording, code snippet

Screen-cast of the broken behavior in Gutenberg
Screen-cast of the correct behavior in Notion

Environment info

  • WordPress 5.9
  • Chrome, Firefox
  • Ubuntu 20.04

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@talldan talldan added [Block] Quote Affects the Quote Block [Type] Bug An existing feature does not function as intended labels Oct 6, 2021
@ellatrix
Copy link
Member

You're right, Delete shouldn't undo it.

@ellatrix ellatrix added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Aug 16, 2023
@mhkuu
Copy link
Contributor

mhkuu commented Apr 18, 2024

I found that this is a more generic issue with transforms through prefixes, as I can also reproduce it with creating a list block by prepending * or - . I tracked it down to packages/block-editor/src/components/rich-text/use-undo-automatic-change.js where we allow the automatic change to be undone on pressing the delete, backspace, and escape button. I'll create a PR to remove the DELETE key from the guard so that only backspace and escape triggers the undo 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Quote Affects the Quote Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants