Skip to content

Conversation

@msukkari
Copy link
Contributor

@msukkari msukkari commented Jan 22, 2026

Dynamically display keyboard shortcuts as '⌘' on Mac and 'Ctrl' on non-Mac platforms to fix incorrect key hints (SOU-255).

Fixes #780


Linear Issue: SOU-255

Open in Cursor Open in Web

Summary by CodeRabbit

  • Bug Fixes
    • Fixed keyboard shortcut hints to display correctly on PC. Shortcuts now show the appropriate modifier keys for each platform.

✏️ Tip: You can customize this high-level summary in your review settings.

… hints

The KeyboardShortcutHint component now detects the user's platform and
displays 'Ctrl' instead of '⌘' for Windows/Linux users. This fixes the
issue where the Reference Guide hint (and other keyboard shortcut hints)
incorrectly showed Mac-specific keyboard symbols on non-Mac platforms.

Co-authored-by: michael <michael@sourcebot.dev>
@cursor
Copy link

cursor bot commented Jan 22, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

A platform-aware keyboard shortcut rendering fix is implemented to display "Ctrl" on non-Mac keyboards instead of the Mac command key (⌘). The CHANGELOG.md documents this fix, and the keyboardShortcutHint.tsx component is updated with platform detection logic using getPlatformShortcut and useMemo to compute the correct shortcut symbol.

Changes

Cohort / File(s) Summary
Changelog Documentation
CHANGELOG.md
Added entry in Fixed section documenting the platform-aware shortcut hint fix for PC users
Keyboard Shortcut Component
packages/web/src/app/components/keyboardShortcutHint.tsx
Added getPlatformShortcut function to map Mac keyboard symbols to platform-appropriate equivalents; integrated useMemo to compute platform-specific shortcuts; updated aria-label to reflect the rendered shortcut; retained public component signature and styling

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@msukkari msukkari changed the title Reference guide key hint fix(ui): Fix reference guide key hint for PC Jan 22, 2026
@msukkari msukkari marked this pull request as ready for review January 22, 2026 21:12
@msukkari msukkari merged commit 51b76c4 into main Jan 22, 2026
9 of 10 checks passed
@msukkari msukkari deleted the cursor/SOU-255-reference-guide-key-hint-c514 branch January 22, 2026 21:15
@msukkari
Copy link
Contributor Author

Thanks for raising, fix will be in new release which should be up in a few minutes

return shortcut;
}
// Replace Mac Command key symbol with Ctrl for non-Mac platforms
return shortcut.replace(//g, 'Ctrl');
Copy link
Contributor

Choose a reason for hiding this comment

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

@msukkari we probably want mapping for ⌥ and ^ as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can spin up another PR to replace all of them, because it looks like is referenced in a lot of other places too. Just to sanity check ⌘ == ctrl, ⌥ == alt in Sourcebot?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i.e. is the actual logic mapping for the key correct in Sourcebot for PC or does that need to be fixed too

Copy link
Contributor

Choose a reason for hiding this comment

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

I would look at https://www.npmjs.com/package/react-hotkeys-hook to see what mapping it uses

Copy link
Contributor

Choose a reason for hiding this comment

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

I think an improvement here would actually to just take whatever format react-hotkeys expects in KeyboardShortcutHint and translate that into what we display in the shortcut. I believe every KeyboardShortcutHint will be paired with a useHotkeys, so it probably makes sense to make it consistent and share the same hotkey as a variable s.t., we avoid running into situations where the hint and the actual hotkey do not match.

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.

[bug] Reference Guide Key Hint Assumes Mac Keyboard

4 participants