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 the Cut block action to the block actions menu #68550

Open
2 of 6 tasks
afercia opened this issue Jan 8, 2025 · 3 comments · May be fixed by #68554
Open
2 of 6 tasks

Add the Cut block action to the block actions menu #68550

afercia opened this issue Jan 8, 2025 · 3 comments · May be fixed by #68554
Assignees
Labels
[Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jan 8, 2025

Description

Noticed while testing #68167

The Options menu in the block toolbar provides access to some block actions like Copy, Copy Styles, Paste Styles.
While testing these features I discovered there's also a 'Cut block' action that only works via keyboard shortcut Cmd/Ctrl + x. I didn't know this action existed or maybe I didn't rationalize and mentally absorbed that it existed. Which proves it's very little discoverable.

In fact, the Cut action isn't present in the Options menu, which feels like the most natural place for a Cut operation.

I'm not sure whether this has been discussed elsewhere and what the reasoning behind not exposing the Cut action in a prominent place is, but I'd think that since the editor already provides actions that are conceptually related in the Options menu, the Cut action should be exposed there.

Testing with two styled Paragraphs:

  • When cutting one paragraph, an appropriate snackbar notice informs users a block has been 'moved' to the clipboard.
  • With both paragraphs selectred, the snackbar notice informs users that two blocks have been 'moved' to the clipboard.

Image

However, the Options menu doesn't provide a 'Cut' action:

Image

Also, it is worth noting that neither the Cut keyboard shortcut not the Copy keyboard shortcut are listed in the Keyboard shortcuts modal dialog.

Step-by-step reproduction instructions

  • Select one or more blocks.
  • Press the Cmd/Ctrl + x keys.
  • Observe your selected block(s) have been cut.
  • Observe the editor shows an appropriate snackbar notice.
  • Observe the Options menu of the block toolbar doesn't have a 'Cut' action available.

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@afercia afercia added [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended labels Jan 8, 2025
@yogeshbhutkar
Copy link
Contributor

Thanks for raising the issue @afercia.

I'll be working on adding the cut option in the block options menu.

@yogeshbhutkar
Copy link
Contributor

Hi @afercia, while working on the issue, I found three more inconsistencies:

  1. Copying a block triggers a snackbar notification, but pasting does not. At first glance, a notification for pasting might seem unnecessary since the action is visually apparent on the screen. However, there is a difference in behavior between Copy and Paste Styles. After pasting styles, a snackbar notification is appropriately displayed, which introduces a slight inconsistency.

Do you think a snackbar notification should also appear when a block is pasted to improve accessibility and maintain consistency?

Screen.Recording.2025-01-09.at.1.26.51.PM.mov
  1. When selecting either Copy Styles or Paste Styles, the options menu remains open, unlike other actions where the menu closes automatically. This behavior, as shown in the video above, requires an additional click to close the menu, which feels like an unnecessary extra step for the user.

  2. In addition to listing the Cut and Copy options in the keyboard shortcuts dialog, I believe the Paste option should also be included for the sake of completeness.

@afercia
Copy link
Contributor Author

afercia commented Jan 9, 2025

Re: focus management: most of the actions in the menu manage focus appropriately to avoid a focus loss when using the keyboard. For example:

  • Duplicate, Add before, Add after: move focus to the newsly inserted block
  • Group: moves focus to the Group block
  • Lock, Rename, Create Pattern: move focus to the modal dialog
  • etc.

Copy, Copy Styles, Paste Styles need to avoid a focus loss as well. For this reason, the menu stays open and focus stays on the menu item. I'm not opposed to consider a different behavior e.g. closing the menu and moving focus to the block but it seems to me it's out of the scope of this issue.

Regarding the other points: yes there are a few inconsistencies across all the copy and paste operations and also flows that are potentially confusing fo rusers, The snackbar notifications aren't great for accessibility but at least they also trigger an audible message for screen reader users. I'd agree there should be more consistency but still its out of the scope of this issue and should be addressed separately. Re: 3) yes, good point.

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 [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants