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

Shortcuts: Delete multi selection shortcut triggered when clearing sidebar controls #37316

Closed
aaronrobertshaw opened this issue Dec 13, 2021 · 1 comment · Fixed by #37595
Closed
Assignees
Labels
[Package] Block editor /packages/block-editor [Package] Keyboard Shortcuts /packages/keyboard-shortcuts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@aaronrobertshaw
Copy link
Contributor

Description

Current Behaviour:

While multiple blocks are selected, clearing values from inputs in the BlockInspector using del or backspace, will trigger the keyboard shortcut to delete blocks, unexpectedly removing them.

Expected Behaviour:

Using delete or backspace to clear values in a control such as the UnitControl would only clear that input's value not trigger removal of multiple blocks.

Step-by-step reproduction instructions

  1. On trunk, create a Post and add multiple paragraph blocks with text to it
  2. Select those multiple paragraphs together
  3. In the block inspector expand the color panel, click the color swatch, then toggle the edit button for the color value
  4. In the color value field, press either the del or backspace keys
  5. Notice the blocks were deleted.

Note: Typgraphy panel will not be visible for multiple selections until #37216 lands. This issue can also be replicated using line-height or letter-spacing if testing with that PR branch.

Screenshots, screen recording, code snippet

Screen.Recording.2021-12-13.at.2.15.39.pm.mp4

Environment info

  • WordPress 5.8
  • Gutenberg: Latest

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

@aaronrobertshaw aaronrobertshaw added [Type] Bug An existing feature does not function as intended [Package] Block editor /packages/block-editor [Package] Keyboard Shortcuts /packages/keyboard-shortcuts labels Dec 13, 2021
@ramonjd
Copy link
Member

ramonjd commented Dec 13, 2021

I have a very naive attempt at a fix in #37326

It's based on the premise that we should execute block-specific side effects where the focussed keydown target is not in the block editor.

There are probably use-cases that defeat this premise though 🤷

The curious thing is the block inspector search box does not trigger the keyDown event handlers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Package] Keyboard Shortcuts /packages/keyboard-shortcuts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
3 participants