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

Backspace key moves default block into Group block instead of deleting the default block #65850

Open
2 tasks done
afercia opened this issue Oct 3, 2024 · 3 comments
Open
2 tasks done
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Oct 3, 2024

Description

When pressing the Backspace key (del) in the default block or in an empty paragraph, I expect the default block to be deleted and the previous block to be selected.

This works in most cases, but it doesn't work when the previous block is a Group. Note: I haven't tested with other blocks so it would be great to double check whether this inconsistent behavior happens only with the Group block os also with other ones. As an user, I'm totally confused by this inconsistent behavior. I learned that backspace is supposed to delete the empty default block but in some cases it does something different.

It is worth mentioning that at first I thought the Group block was being deleted instead of the default block. Turns out the Group block isn't deleted. Instead the default block gets moved into the Group block thus becoming a nested paragraph. As an user, this behavior is totally unexpected to me and breaks an established interaction pattern where I expect the backspace key to just delete the empty paragraph.

I think providing a consistent, predictable behavior is key to provide a cohesive user experience. The behavior of the backspace key should be standardized ans always perform the same action. Adding tests would be beneficial as well.

Animated GIF to illustrate:

Image

Step-by-step reproduction instructions

  • Edit a post.
  • Open the List View to better check what happens with the blocks deletion and selection.
  • Add a Table block.
  • Click the empty area below the table block to add the default paragraph block.
  • Click again to select the default paragraph block and focus it.
  • Press the backspace key.
  • Observe the default paragraph block gets deleted and the Table block gets selected.
  • Add a Columns block.
  • Repeat the steps above and observe the behavior is consistent.
  • Add a Group block.
  • Repeat the steps above.
  • Observe that, visually in the canvas, it looks like the Group block gets deleted and the default block stays, which is extremely confusing.
  • By observing the List view you can get what actually happens.
  • Observe the default paragraph block isn't deleted and instead it gets moved into the Group block.
  • Expected: the default paragraph block to be deleted and the Group block to be selected.

Screenshots, screen recording, code snippet

No response

Environment info

No response

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
@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended labels Oct 3, 2024
@Mamaduka
Copy link
Member

Mamaduka commented Oct 3, 2024

@kevin940726, since you worked on recent fixes in the area; is this an expected behavior?

@kevin940726
Copy link
Member

Yeah I think this behavior is unrelated to the recent fix and has been here for a while now. I'm not sure if this is an expected behavior, though. I agree it would be nice to handle this, even treat it as a special case if necessary.

@afercia
Copy link
Contributor Author

afercia commented Oct 4, 2024

Yeah I think this behavior is unrelated to the recent fix and has been here for a while now.

I forgot to mention this can be reproduced in WordPress 6.6 and 6.5 as well (haven't tested earlier releases) so yes it's been around for a while. Still, it's an inconsistent and unexpected beheavior. I think the backspace key should always do the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants