Skip to content

Conversation

@hotzenklotz
Copy link
Member

@hotzenklotz hotzenklotz commented Jan 2, 2026

A small PR to add Mac support to trigger extended keyboard shortcut. In other words, CMD + K instead of CTRL + K. The Mac shortcut is already documented in our docs but was not implemented until now.

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • Use a Mac
  • Open annotation
  • Try an extended keyboard shortcut, e.g. CMD + K, E

Issues:

  • None

(Please delete unneeded items, merge only when none are left open)

  • Added changelog entry (create a $PR_NUMBER.md file in unreleased_changes or use ./tools/create-changelog-entry.py)
  • Added migration guide entry if applicable (edit the same file as for the changelog)
  • Updated documentation if applicable
  • Adapted wk-libs python client if relevant API parts change
  • Removed dev-only changes like prints and application.conf edits
  • Considered common edge cases
  • Needs datastore update after deployment

@hotzenklotz hotzenklotz self-assigned this Jan 2, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 2, 2026

📝 Walkthrough

Walkthrough

The changes add macOS support for extended command key shortcuts by exporting a platform detection constant (isMac) from the constants module and using it to dynamically bind "command + k" on macOS versus "ctrl + k" on other platforms, with a corresponding changelog entry.

Changes

Cohort / File(s) Summary
Platform Detection Export
frontend/javascripts/viewer/constants.ts
Changed isMac from private to exported constant, enabling platform detection to be used across modules
Dynamic Keybinding
frontend/javascripts/libs/input.ts
Imported isMac and updated EXTENDED_COMMAND_KEYS to conditionally use "command + k" on macOS or "ctrl + k" on other platforms
Changelog
unreleased_changes/9161.md
Added new entry documenting macOS support for extended trigger shortcuts using CMD + K

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A Mac-bound bunny hops with glee,
Command + K works perfectly!
No longer does the platform fight,
macOS keybinds now feel right! 🐰⌘

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Added Mac support to trigger extended keyboard shortcuts' directly and clearly describes the main change: implementing Mac (CMD + K) support for extended keyboard shortcuts.
Description check ✅ Passed The description clearly explains the change (CMD + K instead of CTRL + K for Mac), provides context (was already documented but not implemented), and includes testing steps and a changelog entry.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01356b0 and 01a5249.

📒 Files selected for processing (3)
  • frontend/javascripts/libs/input.ts
  • frontend/javascripts/viewer/constants.ts
  • unreleased_changes/9161.md
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-12-11T15:25:53.526Z
Learnt from: knollengewaechs
Repo: scalableminds/webknossos PR: 9117
File: frontend/javascripts/admin/statistic/time_tracking_overview.tsx:261-279
Timestamp: 2025-12-11T15:25:53.526Z
Learning: Ant Design v6 Select: when using the Select component, consider supplying a prefix prop to render an icon or element before the input for better visual context. Apply this guideline to TS and TSX files across the codebase where Ant Design Select is used; ensure prefix usage is accessible (e.g., provide meaningful aria-label if needed) and avoid unnecessary prefixes on simple inputs.

Applied to files:

  • frontend/javascripts/viewer/constants.ts
  • frontend/javascripts/libs/input.ts
📚 Learning: 2025-09-04T10:01:56.727Z
Learnt from: knollengewaechs
Repo: scalableminds/webknossos PR: 8895
File: frontend/javascripts/viewer/view/action_bar_view.tsx:0-0
Timestamp: 2025-09-04T10:01:56.727Z
Learning: In frontend/javascripts/viewer/view/action_bar_view.tsx, knollengewaechs prefers not to use onKeyUpCapture for preventing modal close on modifier keys because: 1) holding ctrl while opening modal will still close on keyup, 2) normal case of opening modal then pressing ctrl doesn't cause issues with just onKeyDownCapture.

Applied to files:

  • frontend/javascripts/libs/input.ts
🧬 Code graph analysis (1)
frontend/javascripts/libs/input.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • isMac (395-407)
🪛 LanguageTool
unreleased_changes/9161.md

[uncategorized] ~2-~2: The operating system from Apple is written “macOS”.
Context: ### Added - Added MacOS supported trigger extended keyboard sho...

(MAC_OS)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests
  • GitHub Check: frontend-tests
🔇 Additional comments (2)
frontend/javascripts/libs/input.ts (1)

10-10: LGTM! Platform-specific keyboard binding implemented correctly.

The import and dynamic binding properly enable CMD+K on macOS while maintaining CTRL+K on other platforms. The existing preventBrowserSearchbarShortcut method (lines 132-137) already handles both ctrlKey and metaKey, which complements this change nicely.

Also applies to: 72-72

frontend/javascripts/viewer/constants.ts (1)

395-407: LGTM! Platform detection constant properly exported.

Exporting isMac enables external modules to implement platform-specific logic. The implementation is defensive with proper error handling, and the comments appropriately document the deprecated status of navigator.platform while explaining why it's still used.

@@ -0,0 +1,2 @@
### Added
- Added MacOS supported trigger extended keyboard shortcuts with CMD + K
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix capitalization and grammar.

The operating system should be "macOS" (official Apple spelling), and the grammar needs adjustment.

🔎 Suggested fix
-### Added
-- Added MacOS supported trigger extended keyboard shortcuts with CMD + K
+### Added
+- Added macOS support to trigger extended keyboard shortcuts with CMD + K
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Added MacOS supported trigger extended keyboard shortcuts with CMD + K
- Added macOS support to trigger extended keyboard shortcuts with CMD + K
🧰 Tools
🪛 LanguageTool

[uncategorized] ~2-~2: The operating system from Apple is written “macOS”.
Context: ### Added - Added MacOS supported trigger extended keyboard sho...

(MAC_OS)

🤖 Prompt for AI Agents
In unreleased_changes/9161.md around line 2, fix capitalization and grammar:
change "Added MacOS supported trigger extended keyboard shortcuts with CMD + K"
to proper macOS styling and clearer phrasing—e.g., "Added macOS-supported
trigger for extended keyboard shortcuts using ⌘+K (Command+K)". Ensure "macOS"
is lowercase 'm' and include either the ⌘ symbol or "Command" for clarity.

@hotzenklotz hotzenklotz requested a review from normanrz January 6, 2026 13:42
@hotzenklotz hotzenklotz enabled auto-merge (squash) January 6, 2026 13:59
@hotzenklotz hotzenklotz merged commit 7d2169f into master Jan 6, 2026
5 checks passed
@hotzenklotz hotzenklotz deleted the fix-extended-keys-mac branch January 6, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants