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

Add remove block keyboard shortcut #8805

Merged
merged 4 commits into from
Aug 14, 2018
Merged

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Aug 10, 2018

Description

Related #2980, #8279

  • Adds the keyboard shortcut Ctrl+Alt+Backspace / Alt+Cmd+Backspace for removing a block
  • Allows that key combination to bubble from RichText's onDeleteKeyDown function
  • Adds the shortcut to the keyboard shortcut help modal

How has this been tested?

  • Tested on Windows (chrome/edge/IE11/firefox/opera)
  • Tested on Mac (chrome/safari/firefox/opera)
  • Tested deleting a single block
  • Tested deleting multiple blocks

Screenshots

Block Settings Menu:
screen shot 2018-08-10 at 11 49 31 am

Shortcuts Help Modal
screen shot 2018-08-10 at 11 49 09 am

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@talldan talldan added the [Type] Enhancement A suggestion for improvement. label Aug 10, 2018
@talldan talldan added this to the 3.6 milestone Aug 10, 2018
@talldan talldan self-assigned this Aug 10, 2018
@talldan talldan force-pushed the add/remove-block-keyboard-shortcut branch from 1ae1625 to e608ed3 Compare August 10, 2018 03:59
@talldan talldan changed the title Add/remove block keyboard shortcut Add remove block keyboard shortcut Aug 10, 2018
Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good! 👍

It would be nice if, after deleting a block, your cursor was positioned at the end of the previous block instead of at the start. Not a blocker though.

// User is using the Remove Block shortcut, so allow the event to bubble
if ( altKey && metaKey && isReverse ) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fear that, if we later change the shortcut, this code will be left here for the eternity of time... not sure how to fix that, though. Maybe let's explicitly mention the shortcut and component in the comment?

// User is using the Remove Block shortcut (Alt+Meta+Backspace), so allow the event to bubble up to <BlockSettingsMenu>

@talldan talldan force-pushed the add/remove-block-keyboard-shortcut branch from e608ed3 to 4b3c3e6 Compare August 13, 2018 07:16
@talldan talldan force-pushed the add/remove-block-keyboard-shortcut branch from 4b3c3e6 to 178325e Compare August 13, 2018 19:33
@talldan talldan merged commit acef68f into master Aug 14, 2018
@talldan talldan deleted the add/remove-block-keyboard-shortcut branch August 14, 2018 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants