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

Try forward slash keyboard shortcut for command palette #52386

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

stokesman
Copy link
Contributor

@stokesman stokesman commented Jul 6, 2023

What?

Changes the keyboard shortcut for the command palette.

Why?

The current shortcut is conflicted with the longstanding shortcut for adding a link to rich text and that breaks the intended global availability of the command palette shortcut.
To fix #51737

How?

  • Replaces the character “K” with another. For the moment, it's “/” and that required a little circumstantial update to allow the character to display in the keyboard shortcuts modal.
  • Updates the hint in the Site Editor header.
  • Adds an alias keyboard shortcut. Currently ”F1”.

Testing Instructions

In either the Site or Post editors launch the command palette by pressing:

  • macOS either: +/ or F1
  • Windows (and others?) either: Ctrl+/ or F1

Test it from a rich text area too and delight in the lack of conflict 🎊 .

@stokesman stokesman added the [Package] Commands /packages/commands label Jul 6, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Size Change: +11 B (0%)

Total Size: 1.7 MB

Filename Size Change
build/commands/index.min.js 15.6 kB +7 B (0%)
build/editor/index.min.js 61.7 kB +4 B (0%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 964 B
build/annotations/index.min.js 2.71 kB
build/api-fetch/index.min.js 2.33 kB
build/autop/index.min.js 2.11 kB
build/blob/index.min.js 590 B
build/block-directory/index.min.js 7.25 kB
build/block-directory/style-rtl.css 1.04 kB
build/block-directory/style.css 1.04 kB
build/block-editor/content-rtl.css 4.31 kB
build/block-editor/content.css 4.31 kB
build/block-editor/default-editor-styles-rtl.css 403 B
build/block-editor/default-editor-styles.css 403 B
build/block-editor/index.min.js 247 kB
build/block-editor/style-rtl.css 15.4 kB
build/block-editor/style.css 15.4 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 90 B
build/block-library/blocks/archives/style.css 90 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 138 B
build/block-library/blocks/audio/theme.css 138 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 419 B
build/block-library/blocks/button/editor.css 417 B
build/block-library/blocks/button/style-rtl.css 632 B
build/block-library/blocks/button/style.css 631 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/columns/style-rtl.css 421 B
build/block-library/blocks/columns/style.css 421 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 199 B
build/block-library/blocks/comment-template/style.css 198 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.7 kB
build/block-library/blocks/cover/style.css 1.69 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 98 B
build/block-library/blocks/details/style.css 98 B
build/block-library/blocks/embed/editor-rtl.css 293 B
build/block-library/blocks/embed/editor.css 293 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 138 B
build/block-library/blocks/embed/theme.css 138 B
build/block-library/blocks/file/editor-rtl.css 316 B
build/block-library/blocks/file/editor.css 316 B
build/block-library/blocks/file/style-rtl.css 280 B
build/block-library/blocks/file/style.css 281 B
build/block-library/blocks/file/view.min.js 322 B
build/block-library/blocks/footnotes/style-rtl.css 201 B
build/block-library/blocks/footnotes/style.css 199 B
build/block-library/blocks/form-input/editor-rtl.css 229 B
build/block-library/blocks/form-input/editor.css 228 B
build/block-library/blocks/form-input/style-rtl.css 343 B
build/block-library/blocks/form-input/style.css 343 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 343 B
build/block-library/blocks/form-submission-notification/editor.css 342 B
build/block-library/blocks/form-submit-button/style-rtl.css 69 B
build/block-library/blocks/form-submit-button/style.css 69 B
build/block-library/blocks/form/view.min.js 452 B
build/block-library/blocks/freeform/editor-rtl.css 2.61 kB
build/block-library/blocks/freeform/editor.css 2.61 kB
build/block-library/blocks/gallery/editor-rtl.css 957 B
build/block-library/blocks/gallery/editor.css 962 B
build/block-library/blocks/gallery/style-rtl.css 1.75 kB
build/block-library/blocks/gallery/style.css 1.75 kB
build/block-library/blocks/gallery/theme-rtl.css 122 B
build/block-library/blocks/gallery/theme.css 122 B
build/block-library/blocks/group/editor-rtl.css 654 B
build/block-library/blocks/group/editor.css 654 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 189 B
build/block-library/blocks/heading/style.css 189 B
build/block-library/blocks/html/editor-rtl.css 340 B
build/block-library/blocks/html/editor.css 341 B
build/block-library/blocks/image/editor-rtl.css 834 B
build/block-library/blocks/image/editor.css 833 B
build/block-library/blocks/image/style-rtl.css 1.61 kB
build/block-library/blocks/image/style.css 1.6 kB
build/block-library/blocks/image/theme-rtl.css 137 B
build/block-library/blocks/image/theme.css 137 B
build/block-library/blocks/image/view.min.js 2.02 kB
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 505 B
build/block-library/blocks/media-text/style.css 503 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 671 B
build/block-library/blocks/navigation-link/editor.css 672 B
build/block-library/blocks/navigation-link/style-rtl.css 103 B
build/block-library/blocks/navigation-link/style.css 103 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 299 B
build/block-library/blocks/navigation-submenu/editor.css 299 B
build/block-library/blocks/navigation/editor-rtl.css 2.26 kB
build/block-library/blocks/navigation/editor.css 2.26 kB
build/block-library/blocks/navigation/style-rtl.css 2.25 kB
build/block-library/blocks/navigation/style.css 2.23 kB
build/block-library/blocks/navigation/view.min.js 1.1 kB
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 401 B
build/block-library/blocks/page-list/editor.css 401 B
build/block-library/blocks/page-list/style-rtl.css 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 235 B
build/block-library/blocks/paragraph/editor.css 235 B
build/block-library/blocks/paragraph/style-rtl.css 335 B
build/block-library/blocks/paragraph/style.css 335 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/editor-rtl.css 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 508 B
build/block-library/blocks/post-comments-form/style.css 508 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 666 B
build/block-library/blocks/post-featured-image/editor.css 662 B
build/block-library/blocks/post-featured-image/style-rtl.css 345 B
build/block-library/blocks/post-featured-image/style.css 345 B
build/block-library/blocks/post-navigation-link/style-rtl.css 215 B
build/block-library/blocks/post-navigation-link/style.css 214 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 409 B
build/block-library/blocks/post-template/style.css 408 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 125 B
build/block-library/blocks/preformatted/style.css 125 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 354 B
build/block-library/blocks/pullquote/style.css 354 B
build/block-library/blocks/pullquote/theme-rtl.css 168 B
build/block-library/blocks/pullquote/theme.css 168 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 486 B
build/block-library/blocks/query/editor.css 486 B
build/block-library/blocks/query/style-rtl.css 312 B
build/block-library/blocks/query/style.css 308 B
build/block-library/blocks/query/view.min.js 647 B
build/block-library/blocks/quote/style-rtl.css 237 B
build/block-library/blocks/quote/style.css 237 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/read-more/style-rtl.css 140 B
build/block-library/blocks/read-more/style.css 140 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 184 B
build/block-library/blocks/search/editor.css 184 B
build/block-library/blocks/search/style-rtl.css 602 B
build/block-library/blocks/search/style.css 602 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/search/view.min.js 475 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 234 B
build/block-library/blocks/separator/style.css 234 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 329 B
build/block-library/blocks/shortcode/editor.css 329 B
build/block-library/blocks/site-logo/editor-rtl.css 760 B
build/block-library/blocks/site-logo/editor.css 760 B
build/block-library/blocks/site-logo/style-rtl.css 204 B
build/block-library/blocks/site-logo/style.css 204 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 682 B
build/block-library/blocks/social-links/editor.css 681 B
build/block-library/blocks/social-links/style-rtl.css 1.49 kB
build/block-library/blocks/social-links/style.css 1.49 kB
build/block-library/blocks/spacer/editor-rtl.css 359 B
build/block-library/blocks/spacer/editor.css 359 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 395 B
build/block-library/blocks/table/editor.css 395 B
build/block-library/blocks/table/style-rtl.css 646 B
build/block-library/blocks/table/style.css 645 B
build/block-library/blocks/table/theme-rtl.css 157 B
build/block-library/blocks/table/theme.css 157 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 403 B
build/block-library/blocks/template-part/editor.css 403 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/term-description/style-rtl.css 111 B
build/block-library/blocks/term-description/style.css 111 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 191 B
build/block-library/blocks/video/style.css 191 B
build/block-library/blocks/video/theme-rtl.css 139 B
build/block-library/blocks/video/theme.css 139 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.11 kB
build/block-library/common.css 1.11 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 12.3 kB
build/block-library/editor.css 12.3 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/index.min.js 215 kB
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/style-rtl.css 14.7 kB
build/block-library/style.css 14.7 kB
build/block-library/theme-rtl.css 700 B
build/block-library/theme.css 705 B
build/block-serialization-default-parser/index.min.js 1.13 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/blocks/index.min.js 51.6 kB
build/commands/style-rtl.css 947 B
build/commands/style.css 942 B
build/components/index.min.js 235 kB
build/components/style-rtl.css 12.1 kB
build/components/style.css 12.1 kB
build/compose/index.min.js 12.6 kB
build/core-commands/index.min.js 2.73 kB
build/core-data/index.min.js 72.7 kB
build/customize-widgets/index.min.js 12.1 kB
build/customize-widgets/style-rtl.css 1.36 kB
build/customize-widgets/style.css 1.36 kB
build/data-controls/index.min.js 651 B
build/data/index.min.js 8.96 kB
build/date/index.min.js 17.9 kB
build/deprecated/index.min.js 462 B
build/dom-ready/index.min.js 336 B
build/dom/index.min.js 4.69 kB
build/edit-post/classic-rtl.css 571 B
build/edit-post/classic.css 571 B
build/edit-post/index.min.js 24.9 kB
build/edit-post/style-rtl.css 5.68 kB
build/edit-post/style.css 5.68 kB
build/edit-site/index.min.js 195 kB
build/edit-site/style-rtl.css 15.1 kB
build/edit-site/style.css 15.1 kB
build/edit-widgets/index.min.js 17.4 kB
build/edit-widgets/style-rtl.css 4.44 kB
build/edit-widgets/style.css 4.43 kB
build/editor/style-rtl.css 5.48 kB
build/editor/style.css 5.48 kB
build/element/index.min.js 4.87 kB
build/escape-html/index.min.js 548 B
build/format-library/index.min.js 7.98 kB
build/format-library/style-rtl.css 500 B
build/format-library/style.css 500 B
build/hooks/index.min.js 1.57 kB
build/html-entities/index.min.js 454 B
build/i18n/index.min.js 3.61 kB
build/interactivity/file.min.js 442 B
build/interactivity/image.min.js 2.15 kB
build/interactivity/index.min.js 13 kB
build/interactivity/navigation.min.js 1.23 kB
build/interactivity/query.min.js 791 B
build/interactivity/search.min.js 610 B
build/is-shallow-equal/index.min.js 535 B
build/keyboard-shortcuts/index.min.js 1.76 kB
build/keycodes/index.min.js 1.49 kB
build/list-reusable-blocks/index.min.js 2.11 kB
build/list-reusable-blocks/style-rtl.css 865 B
build/list-reusable-blocks/style.css 865 B
build/media-utils/index.min.js 2.92 kB
build/modules/importmap-polyfill.min.js 12.2 kB
build/notices/index.min.js 964 B
build/nux/index.min.js 2.01 kB
build/nux/style-rtl.css 775 B
build/nux/style.css 771 B
build/patterns/index.min.js 5.43 kB
build/patterns/style-rtl.css 564 B
build/patterns/style.css 564 B
build/plugins/index.min.js 1.81 kB
build/preferences-persistence/index.min.js 2.08 kB
build/preferences/index.min.js 2.52 kB
build/preferences/style-rtl.css 725 B
build/preferences/style.css 728 B
build/primitives/index.min.js 994 B
build/priority-queue/index.min.js 1.52 kB
build/private-apis/index.min.js 1.02 kB
build/react-i18n/index.min.js 631 B
build/react-refresh-entry/index.min.js 9.46 kB
build/react-refresh-runtime/index.min.js 6.78 kB
build/redux-routine/index.min.js 2.71 kB
build/reusable-blocks/index.min.js 2.74 kB
build/reusable-blocks/style-rtl.css 265 B
build/reusable-blocks/style.css 265 B
build/rich-text/index.min.js 10.4 kB
build/router/index.min.js 1.79 kB
build/server-side-render/index.min.js 1.96 kB
build/shortcode/index.min.js 1.4 kB
build/style-engine/index.min.js 2.06 kB
build/token-list/index.min.js 587 B
build/url/index.min.js 3.83 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.8 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 967 B
build/warning/index.min.js 259 B
build/widgets/index.min.js 7.22 kB
build/widgets/style-rtl.css 1.18 kB
build/widgets/style.css 1.18 kB
build/wordcount/index.min.js 1.03 kB

compressed-size-action

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Flaky tests detected in 7a4ea96.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5477893577
📝 Reported issues:

Copy link
Contributor

@alexstine alexstine left a comment

Choose a reason for hiding this comment

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

@stokesman Ctrl+Shift+P does not work in Firefox on Windows due to that command being reserved for private browsing window. Any ideas on how to get around that? Ctrl+/ is working perfectly.

Both commands test great in Google Chrome on Windows.

@t-hamano
Copy link
Contributor

t-hamano commented Jul 7, 2023

I feel it makes sense to use the foreword slash as a shortcut to the command palette.

  • Windows (and others?) either: Ctrl+/ or Ctrl+Shift+P

In Chrome, pressing Ctrl+Shift+P when the developer tools are open will launch the browser's command tool. Conversely, when the developer tools are not open, the print modal appears in my environment.

Personally, I would hesitate to overwrite either browser shortcut, so the alias may not be necessary.

@stokesman
Copy link
Contributor Author

Thanks for the feedback Alex and Aki 🙇. I'm not sure an aliased shortcut is necessary. The only reason I had for it was in case of a third-party plugin that has a code-editing view with a shortcut for toggling comments because that would likely conflict with the primary shortcut. So if we want to include an alias we'll likely want a better one.

@alexstine
Copy link
Contributor

Ctrl+Shift+P is also used to open the commands menu in other applications such as VS Code for example. That is why I think we might really think about making this shortcut work on Windows.

@stokesman
Copy link
Contributor Author

stokesman commented Jul 14, 2023

Alex, I looked into it and Firefox makes overriding certain shortcuts from javascript impossible. So like CodeSandbox does for example, we could use Ctrl+Shift+P, but it's not going to work in Firefox (and that goes for MacOS as well).

I looked at what StackBlitz and GitHub.dev are doing and they use F1 for the command palette. That seems good and I'd guess they've done their homework on general availability so I've changed the alias to that. Still, I wouldn't say an alias is necessary so if there’s any controversy about it we could move forward without it.

@alexstine
Copy link
Contributor

@stokesman Sounds good. Adopting a common pattern makes me feel better.

@t-hamano t-hamano self-requested a review July 15, 2023 04:10
Copy link
Contributor

@t-hamano t-hamano 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 your hard work!

I looked at what StackBlitz and GitHub.dev are doing and they use F1 for the command palette. That seems good and I'd guess they've done their homework on general availability so I've changed the alias to that. Still, I wouldn't say an alias is necessary so if there’s any controversy about it we could move forward without it.

On Windows and Linux, Chrome uses the F1 key to open the Help Center page. Looking at the shortcut list, this shortcut does not appear to exist on the Mac, so overwriting it might not have a significant impact, what do you think?

@stokesman
Copy link
Contributor Author

stokesman commented Jul 15, 2023

On Windows and Linux, Chrome uses the F1 key to open the Help Center page. Looking at the shortcut list, this shortcut does not appear to exist on the Mac, so overwriting it might not have a significant impact, what do you think?

I imagine it is acceptable to override F1 🤷‍♂️. I had a vague memory of it commonly being used for help shortcuts. macOS has +Shift+? for opening the “Help” menu of the current application.

Thanks for taking a closer look Aki 🙌.

@stokesman
Copy link
Contributor Author

I'm pulling in and replying to the parts of @richtabor’s #51737 (comment) that regarded using forward slash.

Everyone has a preference on what shortcut is used.

This is not about preference. It's suggested primarily by internal precedence; the forward slash is already used in the contextual inserter shortcut. Secondarily is external precedence in other applications, e.g. Figma.

it's not likely to be a key combination that most folks can implement without having to find the / key.

I agree it makes sense to pick one that’s easy to use and there are other options. However, has forward slash not been proven given its use for the slash inserter since 2017 (beside its widespread use in other applications)? Have we ever seen complaints about it? Maybe @annezazu would know. Also, if a person has to find the forward slash aren't they accustomed to finding keys anyway—i.e. not a touch typist? It doesn't seem like they'd complain.

fwiw, Figma also employs CMD + P.

We can also alias the shortcut. I had tried CMD+P here actually but didn't like that it can annoyingly trigger the system Print dialog in cases of focus loss that still happen sometimes in Gutenberg.

@annezazu
Copy link
Contributor

Have we ever seen complaints about it?

If I'm reading this right, I haven't seen big complaints about the / inserter but I do know it's difficult to find and is the lesser used of the inserter methods.

@noisysocks noisysocks added the Needs Decision Needs a decision to be actionable or relevant label Jul 25, 2023
@noisysocks
Copy link
Member

Reading through #51737 it seems that there isn't a consensus about changing this. Cmd+K is consistent with other web apps despite its flaws. CC. @WordPress/gutenberg-core @WordPress/gutenberg-design in case I'm wrong but I think this is a wontfix for 6.3 and hopefully can add a command to make links (#51737 (comment)) and/or the ability to customise keyboard shortcuts (#3218) in a future release.

@stokesman
Copy link
Contributor Author

Thanks Anne for the response 🙇 . When you say it's difficult to find I take you mean the inserter itself. I was trying to find out if the forward slash character was reported as hard to utilize. It's my most used inserter method, BTW.


Thanks Robert 👏 Before I reply to some of the points you bring up let me appeal with the third option of moving forward with both shortcuts. Should that not be a way to have consensus?

Cmd+K is consistent with other web apps

Being like other web apps isn’t great when it compromises your own app’s design. Also, consistent with which other web apps? This PR is more like Figma, StackBlitz and GitHub.dev. What research informs us of which is better for WP audience? Gleaning that requires some study and there's not much to leverage without it.

and hopefully can add a command to make links (#51737 (comment)) and/or the ability to customise keyboard shortcuts (#3218) in a future release.

Those points also support moving forward with this PR—perhaps more so. The idea that command-based link UX can be as good as the current one is speculative at this point. If it doesn't work out CMD+K either remains crippled or we have to justify a clunkier link creation UX.

@jasmussen
Copy link
Contributor

Ultimately I see the solution as keyboard shortcut customizability. This is even more important for international keyboards where, for example, the region-hopping shortcut is cumbersome to access on a Danish keyboard at the moment. If such a feature lands, we have some opportunities:

  • Keep ⌘K but you can customize it.
  • Keep ⌘K by default, but suggest during an onboarding modal that ⌘P is another option
  • Go with ⌘P but keep ⌘K for existing installs.

Any combination of the above. And ⌘P is just an example as inspired from VSCode.

@draganescu
Copy link
Contributor

draganescu commented Jul 25, 2023

Hello, I wanted to add my understanding of the aspects here:

  • It is late for the change to land in 6.3, there is no debate here. The change is small indeed, but that could be argued about a zillion potential last moment changes. Let's wait it out until we're clear on what to do. It is a bug but, it is not a big bad bug, it's a small annoying bug. It is also an UX bug, not an implementation bug so the solution should have UX arguments - I mean having a PR is not enough.
  • The argument that Cmd+K is popular is really flawed - Google docs has "Ctrl+`" - not to mention all the other examples @stokesman offered. Actually it seems to me Cmd+K is a fancy thing among OSX users moving around in very specific web areas, myself included. Cmd+K does not do anything in GMail, Facebook etc. where the huge swaths of people are. In most text based apps (e.g. online MSWord) it adds links.
  • Most apps which use Cmd+K for global search are not having the user in a text editing context. They're usually in pre-interaction context, no editing happening. Trying to go around this leads to things like Webflow's behavior: if the context is editing Cmd+K has an inconsistent behavior you need to learn - if text is selected it's made into a link, if no text is selected but text editing is going on Cmd+K does nothing, however, if no editig is going on Cmd+K opens global search. Squarespace does not have Cmd+K in design mode at all, Cmd+K adds links.
  • The argument that / is "hard to find" is very peculiar in its selectiveness. If a user has to write an email is @ easy to find? What if they have to type a web address or type in an email "this/that same". What I mean is that keyboard shortcuts are a feature for people who use the software so much that they want to save the cognitive effort of finding and clicking/pressing buttons by employing mnemonic actions that are perceived as being "faster" because of less context switching. If you are in this position as a user learning that WordPress defines Cmd+. or Cmd+/ or Cmd+K or Cmd+P is the same. Once you learned it it's there.
  • I think we should keep Cmd+K for linking text and use a different shortcut for global search. Cmd+K does not cut it for the block editor's needs. It works fine outside the block editor but alas WordPress is very much about creating content so we need something that works everywhere. I also think we should choose shortcuts not based on popularity contests.

@hanneslsm
Copy link

I haven't looked through the code and tested this PR, but with Slash we really mean the symbol, right?
So, CMD + / automatically means on e.g. German Keyboard Layouts CMD+ SHIFT + 7, yes?
I don't hink this is an issue (it's pretty common to have such kind of shortcuts), but just want to make sure it's considered.

@Mamaduka
Copy link
Member

I just wanted to link this article here, as I think it does an excellent overview of this design pattern - https://maggieappleton.com/command-bar.

@afercia
Copy link
Contributor

afercia commented Sep 25, 2023

I'd vote for the suggested shortcuts

  • Primary + forward slash makes sense for analogy with the slash inserter and it is used in other applications e.g. Microsoft Teams to open the command palette.
  • An alternativ is necessary for all platforms, not only windows, as keyboard layouts other than English may have the forward slash in second function. For example Italian keyboards have the forward slash on the key 7 in second function so users have to press Shift + 7.

Worth also reminding that browsers behave differently when pressing the Shift key, they may or may not emit the same event.key value. See #45019 where depending on the browser, pressing Shift + Control + backtick emitted either the backtick or the tilde.

For this reason I'd recommend to add e2e tests for this shortcut and make the tests run with all browsers, not only with Chrome.

Worth also recommending that while developing this kind of shortcuts should always be manually tested with all browsers, not only macOS Chrome.

@carolinan
Copy link
Contributor

Hi @stokesman, are you available and able to refresh the pull request and solve the merge conflicts?

@stokesman
Copy link
Contributor Author

I've rebased and fixed conflicts. I've given it a quick test and everything seems okay.

@priethor
Copy link
Contributor

First of all, thanks for addressing this issue. However, I am not convinced by the solutions proposed. Control/CMD + K is somewhat standard in the industry, and there are ways to avoid the conflict with the shortcut to add links depending on the context. If we look at similar software, CMD + K acts as a shortcut to adding links only when text is selected, but hitting Esc and then CMD + K opens their equivalent to WordPress`command palette.

Using the / symbol instead doesn't seem to bring the experience much closer to the slash inserter, as the slash inserter requires a different modifier key, and any combination of three keys downgrades the usability of such a powerful tool as the command palette, which will continue becoming more powerful both with core commands and through plugins.

If modifying the behavior depending on the context is not an option, the customizability that @jasmussen explained seems the best path forward to me.

@richtabor
Copy link
Member

I agree with the sentiment that we should not obscure the command palette keyboard functionality.

As I mentioned in #51737 (comment), we probably need to stop the link control from opening via command + k when you don’t have any text selected. That would solve the unexpected behavior, and command + k can invoke LinkControl when you expect it to, while invoking the command center when you expect that.

@afercia
Copy link
Contributor

afercia commented Jan 19, 2024

Control/CMD + K is somewhat standard in the industry, and there are ways to avoid the conflict with the shortcut to add links depending on the context. If we look at similar software, CMD + K acts as a shortcut to adding links only when text is selected, but hitting Esc and then CMD + K opens their equivalent to WordPress`command palette.

Yes, Control/CMD + K is somewhat standard in the industry but it has always been used for adding links, since ages. Historically, that's what this shortcut has always been used for. Alternative usages came later, In the same way, it's the convention WordPress has being using since ages.

I'd think it's important to consider that alternative usages of the Control/CMD + K shortcut are typically implemented in highly specialized software or web applications. As developers / web designers / advanced users, we are used to use these tools and we are, in a way, a little biased. Average WordPress users don't use those tools. They are just used to mentally associate Control/CMD + K to 'add link'. I'm not sure we should change this mental association that has been in place since forever.

If modifying the behavior depending on the context is not an option ...

I'm not sure a contextual based behavior would be ideal. More likely, it would be less discoverable, potentially confusing, unpredictable, and hard to maintain / test for. Also, the feedback about the current context would be mostly visual. There is nothing that would inform users in a semantic, accessible, way that 'you are now in context xyz, the shortcut will behave in a different way'. I'd think that controls (whether they are part of the user interface or keyboard shortcuts) that change their default action contextually rarely provide a good user experience.

... #52386 (comment) seems the best path forward to me

Rather, #3218 as mentioned by @noisysocks would be a more comprehensive solution.

Overall, I'd think simplicity is key. Can we just keep it simple please? No context change please.

@afercia
Copy link
Contributor

afercia commented Jan 19, 2024

As an aside: I just had an idea regarding #3218 which is allowing users to customize the modifier keys rather than the entire set of shortcuts. I'll detail on that issue.

@afercia
Copy link
Contributor

afercia commented Jan 19, 2024

One more thought: To me, the Command palette is close to the concept of the macOS Spotlight. Mac users are familiar with this kind of UI and they know it can be invoked by pressing Cmd+Space.

Microsoft does have a similar tool as well. Not by default though. The Microsoft PowerToys set of utilities do provide a PowerToys Run tool that is similar to Spotlight. Not surprisingly it can be invoked by pressing Alt+Space.

Both tools establish a pattern where some modifier key plus the Space bar key invoke the tool.    

Wouldn't make sense to use the same pattern for the Command palette?

@richtabor
Copy link
Member

Wouldn't make sense to use the same pattern for the Command palette?

Overriding an OS command with an active WordPress window would negate the OS command, which I'd imagine would be quite frustrating.

@draganescu
Copy link
Contributor

draganescu commented Jan 22, 2024

I don't understand how is the UX of "knowing when to press cmd+k" better than not having to know "when", but only "what"? 😁

The UX of:

  • cmd+k is about linking
  • cmd+/ is about quick commands,

all the time - really seems a better experience, even compared to that the fleeting warm and fuzzy that cmd+k "works like it does in Notion".

It's good to have industry standard UX patterns, but in this case as I also summarized above the industry we mention has a different context (a non text editing one) than our editor. The part of the industry dealing with text editing does not employ this small UX convenience for the same reasons we're struggling with here.

@afercia
Copy link
Contributor

afercia commented Jan 22, 2024

Wouldn't make sense to use the same pattern for the Command palette?

Overriding an OS command with an active WordPress window would negate the OS command, which I'd imagine would be quite frustrating.

I didn't mean to override the OS's Cmd+Space. I did mean to use another modifier plus Space. See #3218 (comment)

@richtabor
Copy link
Member

Wouldn't make sense to use the same pattern for the Command palette?

Overriding an OS command with an active WordPress window would negate the OS command, which I'd imagine would be quite frustrating.

I didn't mean to override the OS's Cmd+Space. I did mean to use another modifier plus Space. See #3218 (comment)

As I mentioned earlier, the palette will be more obscured with obscure shortcuts.

I don't think we should change the shortcut, rather resolve the bug at hand. Otherwise we're asking people to change behavior without any benefits to doing so.

It'd be nice if we can each set the command to whatever we'd each like, but the default should remain as it is today. In this potential case, the benefit to the changed behavior is that you made a choice to pick whatever shortcut you fancy. There's a positive experience to change.

Otherwise, changing the shortcut is a nearly arbitrary decision that will certainly lead to confusion, further obscuring the command palette.

@draganescu
Copy link
Contributor

There are three problems with implementing:

if no text is selected then cmd+k opens command palette, if text is selected cmd+k opens link UI

  1. The buttons block when selected opens the link ui on cmd+k - as the buttons can be simple links
  • this is also inconsistent with how the image block works, where cmd+k does not open link UI but the command palette
  1. The bit that @t-hamano mentioned where bringing the command palette in other parts of wordpress where people still use CK editor (out of need) that editor's link kbd shortcut still conflicts with the command palette

  2. I wonder how many people rely on the current cmd+k behavior in WP where if no text is selected and one links to internal content the link w/ the title is automagically inserted. This is a feature which we're removing if we implement the solution in the quote.

@t-hamano
Copy link
Contributor

As an alternative approach, if we change the command palette shortcuts, we might be able to provide UX like the one below to reduce the load on the user. In other words, the specifications are like this.

  • If the cursor is inside a rich text context and the rich text supports link UI functionality, Cmd+k will always show the link UI, regardless of whether the text is selected
  • If you run Cmd+k outside of a rich text context, show a shortcut prompting you to use Cmd+/ (or other keys)

snackbar

This idea was inspired by the UX in Slack. Slack offers another shortcut when you select text and press Cmd+k.

slack

WordPress, especially the Site Editor, has implemented this kind of UX that prompts users for new information. For example, you may have seen a Notice component with the following text:

  • Move Template Parts to Patterns page: Looking for template parts? Find them in "Patterns".
  • Split the block inspector by tabs: Looking for other block settings? They've moved to the styles tab.
  • Rename Reusable Blocks to Patterns: Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.

@richtabor
Copy link
Member

If you run Cmd+k outside of a rich text context, show a shortcut prompting you to use Cmd+/ (or other keys)

What's the harm in just opening command palette, instead of rendering a notice on how to open it?

The Slack example is when you try to do something not intended. It's a negative response to what you're trying to accomplish. We should avoid these if possible.

@draganescu
Copy link
Contributor

@richtabor what @t-hamano suggested is about how to make this transition from cmd+k to cmd+/ work in a friendly UX. So we apply the changes to this PR, cmd+/ is the new key for command palette but we should that nice toast for those:

  • using cmd+k up to now
  • coming from other places which use cmd+k

@afercia
Copy link
Contributor

afercia commented Jan 24, 2024

As I mentioned earlier, the palette will be more obscured with obscure shortcuts.

I'm not sure the palette is 'obscured' because of the associated shortcut, whatever the shortcut is. The command palette is inehrently a hidden feature. Users aren't aware of the existence of the command palette because it's not visually exposed in the UI. If making it more discoverable is desirable, I'd suggest to simply make it visible. by adding a visible control to open it.

I don't think we should change the shortcut, rather resolve the bug at hand. Otherwise we're asking people to change behavior without any benefits to doing so.

I wonder how many amongst the average WordPress users expect Cmd+k to open a command palette. In my opinion this argumentation is highly biased by the fact that, as designers and developers, we are advanced users and we are used to use many different kind of software and a few of them use this Cmd+k convention.

I don't think the vast majority of WordPress users expect Cmd+k to open a command palette so I find the argumentation about changing the shortcut a bit pointless.

It'd be nice if we can each set the command to whatever we'd each like, but the default should remain as it is today

I kindly disagree. The 'default' expectation for Cmd+k is to add a link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Decision Needs a decision to be actionable or relevant [Package] Commands /packages/commands
Projects
No open projects
Status: Punted to 6.5
Development

Successfully merging this pull request may close these issues.

Command Palette: Global command shortcut conflicts with existing shortcut