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

Writing flow: cannot keyboard delete paragraphs with preceding Columns/Group #45436

Closed
t-hamano opened this issue Nov 1, 2022 · 6 comments · Fixed by #53508
Closed

Writing flow: cannot keyboard delete paragraphs with preceding Columns/Group #45436

t-hamano opened this issue Nov 1, 2022 · 6 comments · Fixed by #53508
Assignees
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Nov 1, 2022

Description

When the backspace key is pressed in an empty paragraph block or heading block, the block is deleted and the focus is shifted to the previous block. I think this is the expected behavior.

However, in WordPress 6.1(with or without Gutenberg ) if the block is preceded by a group or column, the block is not deleted, but wrapped in the previous block.

I think this is a bug, not an expected change.

Step-by-step reproduction instructions

See screencast.

Screenshots, screen recording, code snippet

WordPress 6.0

6.0.mp4

WordPress 6.1

wp6.1.mp4

Environment info

  • OS: Windows 11
  • WordPress version: WordPress 6.1-RC6
  • Gutenberg Version: 14.4.0

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

@t-hamano t-hamano added the [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... label Nov 1, 2022
@kathrynwp kathrynwp added [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release labels Nov 1, 2022
@stacimc
Copy link
Contributor

stacimc commented Nov 1, 2022

I tested and was able to reproduce this with:

  • WordPress 6.0.3
  • Gutenberg 14.4.0
  • TT1 blocks
    No other plugins active.

@carolinan
Copy link
Contributor

I am able to reproduce this with 6.1 but not 5.9.5.

I believe this trac issue is a duplicate: core trac 57010.

I use the group block a lot on my sites as a kind of wrapper for all the site content. I have noticed since 6.1, when you delete the top element in the group using the delete key, the whole group gets removed. I made a video.
https://www.loom.com/share/275f988018b24145b7065d9f00e5c3cb
I only hit delete on my keyboard enough times to remove the headers letters but when you remove the last letter the group block goes too.

@priethor
Copy link
Contributor

Is there any update on this issue, @vcanales ?

@vcanales
Copy link
Member

vcanales commented Jul 2, 2023

@priethor, I haven't been able to crack this one yet; it's a bit of a head-scratcher since it involves going deep into parts of Gutenberg state management that I haven't explored yet. I might need to tap into some other minds on this. I'm wondering, though, where it would be best to bring it up. I'll raise the issue in the Making WordPress Slack before the next meeting, but I'd appreciate any other suggestions.

@priethor
Copy link
Contributor

priethor commented Jul 4, 2023

Thanks for the update, @vcanales! Maybe @ellatrix can help here, as she's more familiar with the writing flow.

@vcanales vcanales removed their assignment Jul 4, 2023
@annezazu annezazu changed the title Cannot delete empty paragraphs with backspace key Writing flow: cannot delete empty paragraphs with backspace key Aug 3, 2023
@annezazu annezazu added the Needs Dev Ready for, and needs developer efforts label Aug 3, 2023
@ellatrix
Copy link
Member

ellatrix commented Aug 4, 2023

The problem here is that, when we try to merge two blocks, we attempt to convert the selected block to the block we're trying to merge into, and then merge its inner blocks. For example, when you merge a paragraph or heading into a quote, we convert the paragraph or heading to a quote, and then merge those two quotes.

Now in the case of Columns this is interesting: we convert the paragraph to a Columns block (which is possible since there's a transform), and then we merge these two Columns blocks together. It's a bit strange but not totally weird. The reason why it looks broken is each Column block having a width attribute, and those are not correct after merging. E.g. 50/50 becomes 50/50/100.

Now there's several solutions here:

  • Fix the widths, and allow backspace from a previous to create an additional column. This is weird though, although another backspace would remove the extra column. Jarring experience though.
  • Remove the paragraph => Columns transform (which creates a single Column with a paragraph). I'm not sure how useful this transform is. I think it's a bit weird.
  • Add an API so an exception can be made.

@ellatrix ellatrix changed the title Writing flow: cannot delete empty paragraphs with backspace key Writing flow: cannot keyboard delete paragraphs with preceding Columns/Group Aug 9, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 10, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Aug 16, 2023
@priethor priethor moved this from Needs development to Done in Polish Aug 16, 2023
@mikachan mikachan removed the Needs Dev Ready for, and needs developer efforts label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

9 participants