Skip to content

List: Add keyboard shortcuts to Indent/Outdent tooltips #71053

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

Merged

Conversation

Sukhendu2002
Copy link
Contributor

@Sukhendu2002 Sukhendu2002 commented Aug 5, 2025

What?

Closes: #61716

Adds keyboard shortcut information to the tooltips of the Indent and Outdent toolbar buttons in the List block.

Testing Instructions

  1. Create a new post/page in the block editor
  2. Add a List block
  3. Select a list item and hover over the Indent button in the toolbar
  4. Verify the tooltip shows "Indent" with "Tab" as the keyboard shortcut

@yogeshbhutkar yogeshbhutkar added [Type] Enhancement A suggestion for improvement. [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Block] List Affects the List Block labels Aug 5, 2025
@Sukhendu2002 Sukhendu2002 marked this pull request as ready for review August 5, 2025 13:05
Copy link

github-actions bot commented Aug 5, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Sukhendu2002 <sukhendu2002@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka self-requested a review August 5, 2025 14:40
@@ -53,13 +53,15 @@ export function IndentUI( { clientId } ) {
<ToolbarButton
icon={ isRTL() ? formatOutdentRTL : formatOutdent }
title={ __( 'Outdent' ) }
shortcut="Shift+Tab"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should use displayShortcut to display the Shift key modifier, similar to Command/Control keys.

diff --git a/packages/block-library/src/list-item/edit.js b/packages/block-library/src/list-item/edit.js
index 2907385a07..0d8960c6da 100644
--- a/packages/block-library/src/list-item/edit.js
+++ b/packages/block-library/src/list-item/edit.js
@@ -18,6 +18,7 @@ import {
 } from '@wordpress/icons';
 import { useMergeRefs } from '@wordpress/compose';
 import { useSelect } from '@wordpress/data';
+import { displayShortcut } from '@wordpress/keycodes';
 
 /**
  * Internal dependencies
@@ -53,7 +54,7 @@ export function IndentUI( { clientId } ) {
 			<ToolbarButton
 				icon={ isRTL() ? formatOutdentRTL : formatOutdent }
 				title={ __( 'Outdent' ) }
-				shortcut="Shift+Tab"
+				shortcut={ displayShortcut.shift( 'Tab' ) }
 				description={ __( 'Outdent list item' ) }
 				disabled={ ! canOutdent }
 				onClick={ () => outdentListItem() }

Screenshot

CleanShot 2025-08-06 at 09 52 50

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I've updated the implementation to use displayShortcut.shift('Tab') for the Outdent button while keeping the Indent button as a plain "Tab".

@Mamaduka Mamaduka changed the title Add keyboard shortcuts to Indent/Outdent tooltips List: Add keyboard shortcuts to Indent/Outdent tooltips Aug 6, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @Sukhendu2002!

@Mamaduka Mamaduka merged commit 6778edd into WordPress:trunk Aug 6, 2025
61 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.4 milestone Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] List Affects the List Block [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indent/Outdent toolbar buttons: show shortcut in tooltip
3 participants