Repository navigation
Administration: Keep keyboard shortcuts left-to-right on RTL sites - #15877
shreyasikhar wants to merge 2 commits into
Conversation
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>
|
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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
…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>
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:wp_admin_bar_command_palette_menu(). It showedK⌘instead of⌘K..htaccessisn't writable showedA + ⌘instead of⌘ + A. The twoweb.confignotices use the same markup and are updated for consistency.Using the attribute instead of CSS avoids rtlcss flipping a
directiondeclaration 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
Testing instructions
⌘K, with no change to its position or spacing..htaccessread-only, then open Settings > Permalinks with a pretty permalink structure. Below the Save Changes button, the Mac shortcut should read⌘ + A.Ctrl+KandCtrl + Ashow correctly in both directions.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