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 to clear "Create Reusable Block" modal's name field deletes the selected blocks #37539

Closed
hellofromtonya opened this issue Dec 20, 2021 · 4 comments
Labels
[Block] Block The "Reusable Block" Block [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended

Comments

@hellofromtonya
Copy link
Contributor

Description

Originally reported in WordPress Core's Trac ticket 54652.

Since WordPress 5.9 Beta (works correctly in 5.8.1), backspacing to clear the reusable block's name in the "Create Reusable Block" modal closes the modal and deletes the selected blocks. This is different from WordPress 5.8.1 which clears the name field, but keeps the modal open and does not delete the selected blocks.

The reporter also notes that control Z does not restore the content; however, in my testing, control Z did restore the blocks for me.

Step-by-step reproduction instructions

  1. Add a new post
  2. Add several blocks
  3. Select more than one block
  4. Select options icon in the toolbar
  5. Select "Add to Reusable blocks"
  6. Start to type something in the modal
  7. Backspace to clear the name field

Notice the modal closes and the selected blocks are deleted.

Screenshots, screen recording, code snippet

test-attempt-to-reproduce-54652

Environment info

  • OS: macOS Big Sur
  • Browsers: Chrome, Safari, Edge, and Firefox
  • WordPress: trunk, 5.9 Beta 3, and 5.8.1
  • Theme: TT2 for 5.9, TT1 for 5.8.1
  • Plugins: none and with Gutenberg v 12.1.0 activated
  • Localhost: wp-env and Local

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

@hellofromtonya hellofromtonya added [Type] Bug An existing feature does not function as intended [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Block] Block The "Reusable Block" Block Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Dec 20, 2021
@costdev
Copy link
Contributor

costdev commented Dec 21, 2021

Environment Info
OS: Windows 10
Browser: Chrome
WordPress: trunk
Theme: TT2
Plugins: Gutenberg 12.1

  1. Pressing the Backspace or Delete keys while naming a Reusable Block deletes the content.
  2. Ctrl-Z restores the content after two presses.

Removing this event listener removes the Backspace or Delete behaviour:

gb-37539

  • Removing any other event listener, including (5), doesn't work.
  • It's specifically (4) that seems to be causing the behaviour.

@Mamaduka
Copy link
Member

I think this is a duplicate of #36513, and it also has (unlinked) PR - #36663.

Unfortunately, I'm not sure if the solution proposed in the PR is the proper fix.

/cc @ellatrix.

@costdev
Copy link
Contributor

costdev commented Dec 21, 2021

@Mamaduka You're right, it is a duplicate. I haven't tested the PR, but it seems to only target Backspace - In my testing, the Delete key produced the same behaviour. Testing of the PR should include testing with the Delete key also.

/cc @delowardev

@Mamaduka
Copy link
Member

Good point, @costdev.

I will close this issue as a duplicate and reference your comment in PR.

@Mamaduka Mamaduka added [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed and removed Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Block The "Reusable Block" Block [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants