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

Block editor: "Select all" keyboard shortcut doesn't work anymore in WP 5.8 #33358

Closed
audrasjb opened this issue Jul 12, 2021 · 9 comments · Fixed by #33446
Closed

Block editor: "Select all" keyboard shortcut doesn't work anymore in WP 5.8 #33358

audrasjb opened this issue Jul 12, 2021 · 9 comments · Fixed by #33446
Assignees
Labels
[Package] Keyboard Shortcuts /packages/keyboard-shortcuts [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@audrasjb
Copy link
Contributor

Description

It looks like there is a regression in the block editor. The cmd + A / ctrl + A keyboard shortcut doesn't work anymore.

  • In 5.7.2 and before, one could use this shortcut to select all the blocks available in the current post.
  • In 5.8 RC 2, using this shortcut results in selecting the whole HTML content of the editor screen (see screenshot below).

Screenshots or screen recording (optional)

0ef437364445b2d958a40f53ed158c42

WordPress information

  • WordPress version: 5.8 RC 2
  • Gutenberg version: Not installed
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes (Twenty Twenty)

Device information

  • Device: Desktop
  • Operating system: OSX
  • Browser: Chrome last version
@Mamaduka Mamaduka added [Package] Keyboard Shortcuts /packages/keyboard-shortcuts [Type] Regression Related to a regression in the latest release labels Jul 12, 2021
@gziolo
Copy link
Member

gziolo commented Jul 15, 2021

I see that a related fix #33167 from @adamziel might have been already cherry-picked to WP 5.8 recently. Although, it addresses a different issue.

@audrasjb
Copy link
Contributor Author

audrasjb commented Jul 15, 2021

I see that a related fix #33167 from @adamziel might have been already cherry-picked to WP 5.8 recently. Although, it addresses a different issue.

Cool. Indeed it addresses a different issue but hopefully it may fix the problem?
That said, it wasn't backported for now

@gziolo
Copy link
Member

gziolo commented Jul 15, 2021

I can confirm that this is a regression.

I found this code in WP 5.7 and it's missing in 5.8:

useShortcut(
		'core/block-editor/select-all',
		useCallback(
			( event ) => {
				event.preventDefault();
				multiSelect(
					first( rootBlocksClientIds ),
					last( rootBlocksClientIds )
				);
			},
			[ rootBlocksClientIds, multiSelect ]
		)
	);

It was moved to a different file (packages/block-editor/src/components/writing-flow/use-select-all.js) in 5d0b0f6.

It was further refactored in 37c5148 to stop using useShortcut call, but I see that 'core/block-editor/select-all' shortcut is still being registered in this place:

registerShortcut( {
name: 'core/block-editor/select-all',
category: 'selection',
description: __(
'Select all text when typing. Press again to select all blocks.'
),
keyCombination: {
modifier: 'primary',
character: 'a',
},
} );

@ellatrix, any hints on how to resolve this issue?

@ellatrix
Copy link
Member

It looks like the content is not focused nor is nothing selected when you press cmd+a?

@Mamaduka
Copy link
Member

It looks like the content is not focused nor is nothing selected when you press cmd+a?

Yes, this happens when content isn't focused or selected. However, if I focus on content, then the shortcut works as expected.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 15, 2021
@gziolo
Copy link
Member

gziolo commented Jul 15, 2021

#33446 should fix it.

@ellatrix ellatrix changed the title Block editor: "Copy all" keyboard shortcut doesn't work anymore in WP 5.8 Block editor: "Select all" keyboard shortcut doesn't work anymore in WP 5.8 Jul 15, 2021
@audrasjb
Copy link
Contributor Author

Thanks all for working on this issue <3

@audrasjb
Copy link
Contributor Author

Hi, while testing WP 5.8 RC4 package, I noticed it didn't fix the issue.
I think it's worth to reopen this issue to make it sure it can be addressed before 5.8 is released, if it's even possible :)

@audrasjb
Copy link
Contributor Author

Ok so if you first put the focus on the editor area then it works fine. I think it’s not as good as the previous behavior, but it’s not a blocker anymore for 5.8 in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Keyboard Shortcuts /packages/keyboard-shortcuts [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants