Skip to content

Administration: Keep keyboard shortcuts left-to-right on RTL sites - #15877

Open
shreyasikhar wants to merge 2 commits into
WordPress:trunkfrom
shreyasikhar:fix/66645-command-palette-shortcut-rtl
Open

shreyasikhar wants to merge 2 commits into
WordPress:trunkfrom
shreyasikhar:fix/66645-command-palette-shortcut-rtl

Conversation

@shreyasikhar

@shreyasikhar shreyasikhar commented Nov 10, 2026 •

Copy link
Copy Markdown

On right-to-left sites, keyboard shortcuts in wp-admin show their keys in reverse order on macOS. The <kbd> inherits the page's direction, and ⌘ and + have no direction of their own, so the browser places them after the letter.

This adds dir="ltr" to the <kbd> elements in:

  • Admin bar: the command palette button, wp_admin_bar_command_palette_menu(). It showed K⌘ instead of ⌘K.
  • Settings > Permalinks: the notices with the select-all shortcut. The one shown below the Save Changes button when .htaccess isn't writable showed A + ⌘ instead of ⌘ + A. The two web.config notices use the same markup and are updated for consistency.

Using the attribute instead of CSS avoids rtlcss flipping a direction declaration in the generated RTL stylesheets. The admin bar's CDN fallback script only replaces the <kbd>'s text, so the attribute stays in place. Gutenberg uses the same approach (WordPress/gutenberg#80402, WordPress/gutenberg#86606).

A new PHPUnit test checks the admin bar <kbd> markup for macOS, Windows and missing user agents.

Screenshots

Before After
Admin bar image image
Settings > Permalinks image image

Testing instructions

  1. Set Settings > General > Site Language to العربية (Arabic) and use a Mac.
  2. Open any wp-admin page. The command palette button in the admin bar should show ⌘K, with no change to its position or spacing.
  3. On an Apache server, make .htaccess read-only, then open Settings > Permalinks with a pretty permalink structure. Below the Save Changes button, the Mac shortcut should read ⌘ + A.
  4. Switch back to English and confirm nothing changes visually.
  5. With a Windows or Linux user agent, confirm Ctrl+K and Ctrl + A show correctly in both directions.
  6. Run npm run test:php -- --filter test_command_palette_shortcut_is_ltr.

Trac ticket: https://core.trac.wordpress.org/ticket/66645

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Implementing the fix, writing the PHPUnit test, and drafting the commit messages and PR description; reviewed and tested by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

🤖 Generated with Claude Code

On right-to-left sites, the command palette button in the admin bar
showed its macOS shortcut as `K⌘` instead of `⌘K`. The `<kbd>` inherited
the page's direction, and `⌘` has no direction of its own.

Add `dir="ltr"` to the `<kbd>` so the shortcut always reads left to
right, matching the approach used in Gutenberg.

See #66645.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props shreyasikhar26.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

…on RTL sites.

On right-to-left sites, the `⌘ + A` shortcut in the Permalinks notice
shown when `.htaccess` or `web.config` can't be written displays as
`A + ⌘`, because `⌘` and `+` have no direction of their own.

Add `dir="ltr"` to the `<kbd>` elements in the notice, matching the
admin bar fix.

See #66645.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shreyasikhar shreyasikhar changed the title Toolbar: Keep the command palette shortcut left-to-right on RTL sites Administration: Keep keyboard shortcuts left-to-right on RTL sites Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant