Repository navigation
KeybindingHint: Fix platform-aware Mod ordering - #8762
siddharthkp wants to merge 7 commits into
Conversation
Co-authored-by: Copilot <[email protected]>
🦋 Changeset detectedLatest commit: 2f6a38b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
Uh oh! @siddharthkp, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:
Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the platform-aware modifier-ordering change.
No open issues 🎉
What changed in this PR
Fixes platform-aware Mod ordering in Primer React’s KeybindingHint, keeping displayed shortcuts and screen reader descriptions consistent without changing key names.
Changes:
- Sorts
ModalongsideMetaon Apple platforms andControlelsewhere. - Adds regression coverage for mixed-case modifiers and accessible sequences across three platform groups.
- Documents the behavior, adds a patch changeset, and adjusts timing in a TreeView test.
| File | Description |
|---|---|
packages/react/src/TreeView/TreeView.test.tsx |
Uses fake timers and a synchronous focus assertion in a typeahead test. |
packages/react/src/KeybindingHint/props.ts |
Documents platform-aware Mod sorting. |
packages/react/src/KeybindingHint/KeybindingHint.test.tsx |
Tests visual and accessible modifier ordering across platforms. |
packages/react/src/KeybindingHint/components/utils.ts |
Resolves Mod sorting priority by platform. |
packages/react/src/KeybindingHint/components/Chord.tsx |
Passes the current platform into chord sorting. |
.changeset/fix-keybinding-hint-mod-order.md |
Records the fix for a patch release. |
Review effort: Balanced
|
@copilot resolve the merge conflicts in this pull request |
…od-order # Conflicts: # packages/react/src/TreeView/TreeView.test.tsx Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…nto fix/keybinding-hint-mod-order
|
|
||
| it('supports multiple typed characters', async () => { | ||
| vi.useFakeTimers() | ||
| vi.useFakeTimers({toFake: ['setTimeout', 'clearTimeout']}) |
There was a problem hiding this comment.
Had to add this to pass CI because without this setup, Vitest throws "the timers APIs are not mocked."
|
Ack for failing CI in github-ui, there are tests that expect a specific order. I'll fix those tests before merging this PR (https://github.com/github/github-ui/pull/46458) |
|
Integration test results from github/github-ui PR:
Changes check could not confirm that this PR only changes the expected integration paths. Open the Changes run for the unexpected files or error details. This check is not required for merging. Integration PRs should only change:
Fixes made only in an integration PR do not reach github-ui's main branch. After the upstream Primer PR merges, other integration PRs and release PRs can fail because they do not include those fixes. Before merging your Primer PR:
Please talk to the release conductor or ask in #primer before merging your Primer PR. CI check runs linting, type checking, and unit tests. Check the workflow logs for specific failures. VRT check ensures that when visual differences are detected, the PR cannot proceed until someone acknowledges the changes by adding the "visual difference acknowledged" label. Need help? If you believe this failure is unrelated to your changes, please reach out to the Primer team for assistance. |
Bug
Modmeans Command on Apple devices and Control on other devices.KeybindingHintdisplayed the correct key name, but sortedModas an ordinary key. Shortcut hints put this key after Shift instead of before it. Screen reader descriptions had the same error.Fix
Give
Modthe same sorting priority asMetaon Apple devices andControlon other devices. Use this order in displayed shortcuts and screen reader descriptions. The displayed key names do not change.Before and After
Rollout strategy
Testing & Reviewing
KeybindingHintunit tests pass locally. Regression tests cover mixed-caseMod, all three platform groups, and accessible shortcut sequences.Shift+Meta+Khas the same order before and after the fix on all three platform groups.