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

Verse Block doesn't delete on backspace #26220

Closed
DaisyOlsen opened this issue Oct 16, 2020 · 5 comments · Fixed by #30104
Closed

Verse Block doesn't delete on backspace #26220

DaisyOlsen opened this issue Oct 16, 2020 · 5 comments · Fixed by #30104
Assignees
Labels
[Block] Verse Affects the Verse block [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress

Comments

@DaisyOlsen
Copy link
Contributor

Describe the bug
Verse block should be able to delete with backspace and move focus to previous widget. Currently the widget is not deleted but the focus does change

To reproduce
Steps to reproduce the behavior:

  1. Create a new post or edit an existing one.
  2. Add a few blocks with content and an empty verse block in 2nd or later block.
  3. Type into verse block and then backspace one time more than enough to clear content.
  4. Widget in focus will return to previous block, empty Verse widget will remain.

Expected behavior
Similar to Paragraph block the widget should be deleted when backspacing far enough to remove all content.

Screenshots
Demo

@DaisyOlsen DaisyOlsen added [Block] Verse Affects the Verse block Needs Dev Ready for, and needs developer efforts labels Oct 16, 2020
@ntsekouras
Copy link
Contributor

Hey @DaisyOlsen - thanks for reporting this. After a quick test it seems that this happens after a Cover block (at least), it doesn't happen after a paragraph and you are 'locked' there if you are after a Heading block, no matter how many times you press backspace.

So it needs more testing to find the inconsistent behavior, that seems related to the previous block.

@ntsekouras ntsekouras added the Needs Testing Needs further testing to be confirmed. label Oct 19, 2020
@gziolo gziolo added the [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... label Nov 8, 2020
@rafaelgallani
Copy link
Contributor

I managed to reproduce it locally, can I look at this one?

@paaljoachim
Copy link
Contributor

paaljoachim commented Mar 18, 2021

Testing with WordPress 5.7.
Gutenberg plugin 10.1.1.
Twenty Twenty One.

Backspacing to delete the verse block leaves it in the layout even though I have "deleted" it and even the content in blocks before it.

@gwwar
Copy link
Contributor

gwwar commented Mar 18, 2021

A quick way of getting into this state is navigating to the code editor, and updating content with:

<!-- wp:verse -->
<pre class="wp-block-verse"></pre>
<!-- /wp:verse -->

Go back to the visual editor. Backspace won't remove the verse block and add a default paragraph.

@gwwar gwwar removed the Needs Testing Needs further testing to be confirmed. label Mar 18, 2021
@rafaelgallani
Copy link
Contributor

rafaelgallani commented Mar 22, 2021

#26220 (comment) was extremely helpful!
This behavior indeed was depending on the previous block, and the reason for that is that the verse block was firing the onMerge event when the backspace key was pressed, hence it was being merged (but not deleted) on the previous paragraph blocks.

All I had to do was add the onRemove handler, so the block would also fire this event when needed. I'll open the PR right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Verse Affects the Verse block [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants