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

Fix: Clicking On Backspace Makes Reusable Block Modal Disappear #36663

Conversation

delowardev
Copy link
Contributor

@delowardev delowardev commented Nov 19, 2021

Description

When creating a reusable block, if someone tries to delete a character from the block name by clicking backspace it removes all the selected blocks instead of deleting the character.

See: #36513

How has this been tested?

WP Version: 5.8.2
Device: Macbook Pro M1
OS: macOS Monterey

Please check the attached video on how to replicate and test.

Screenshots

reusable-block-backspace-bug.mp4

Types of changes

Bugfix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@delowardev delowardev force-pushed the fix/reusable-blocks-keyboard-issue branch from 2b13f04 to 2da4016 Compare November 19, 2021 17:18
@delowardev delowardev marked this pull request as draft December 7, 2021 17:27
@delowardev delowardev force-pushed the fix/reusable-blocks-keyboard-issue branch from 79967d9 to 85ec8c6 Compare December 7, 2021 19:14
@delowardev delowardev marked this pull request as ready for review December 7, 2021 19:15
@Mamaduka
Copy link
Member

Hi, @delowardev

@costdev mentioned that we'll need to check the DELETE keycode as well.

@Mamaduka Mamaduka added [Block] Block The "Reusable Block" Block [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Bug An existing feature does not function as intended 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
@Mamaduka Mamaduka requested a review from ellatrix December 21, 2021 13:58
@Mamaduka Mamaduka added the [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable label Dec 21, 2021
@delowardev
Copy link
Contributor Author

Hi, @delowardev

@costdev mentioned that we'll need to check the DELETE keycode as well.

DELETE key check added in 83582bf

@Mamaduka
Copy link
Member

Thank you, @delowardev.

@ntsekouras
Copy link
Contributor

Thanks for the PR @delowardev !

This feels like there is a deeper underlying issue and we should try to dig deeper first.

@delowardev
Copy link
Contributor Author

@ntsekouras
My point was it shouldn't fire delete events when the user is writing something ( when the input field is in focus ). But you're right, actually; another solution could be preventing the delete operation when the modal is open.

@ntsekouras
Copy link
Contributor

Thanks for your work here @delowardev! I'll close this as an alternative approach was merged for this here: #37595

@ntsekouras ntsekouras closed this Dec 23, 2021
@ntsekouras ntsekouras removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Dec 23, 2021
@delowardev delowardev deleted the fix/reusable-blocks-keyboard-issue branch December 23, 2021 07:17
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] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selected blocks get deleted when creating a reusable block and pressing backspace key
3 participants