Skip to content

feat(boards): add keyboard shortcuts for board switching - #6393

Open
ajnart wants to merge 1 commit into
devfrom
board-keyboard-shortcuts
Open

feat(boards): add keyboard shortcuts for board switching#6393
ajnart wants to merge 1 commit into
devfrom
board-keyboard-shortcuts

Conversation

@ajnart

@ajnart ajnart commented Jul 18, 2026

Copy link
Copy Markdown
Member

Description

Adds keyboard shortcuts to quickly switch between boards without using the mouse.

Shortcuts

  • mod+shift+ArrowRight — switch to next board
  • mod+shift+ArrowLeft — switch to previous board
  • mod+shift+1 through mod+shift+9 — jump to board by index (1-based)

mod = Ctrl on Windows/Linux, Cmd on macOS.

Implementation

  • Uses Mantine's useHotkeys hook (already used in the same file for edit mode toggle)
  • Shortcuts are ignored when typing in inputs (Mantine default behavior)
  • Extracted into a clean BoardNavigationHotkeys component
  • Fixed a small logic issue: the board switcher menu is now always visible, even for users without change access

Closes #6392

Summary by CodeRabbit

  • New Features

    • Added keyboard shortcuts for navigating between boards.
    • Use modifier + Shift + Arrow keys to move to adjacent boards.
    • Use modifier + Shift + number keys to jump to one of the first nine boards.
  • Improvements

    • Board selection remains available without edit access.
    • Edit-related actions now appear only when permitted.

- mod+shift+ArrowRight / mod+shift+ArrowLeft to cycle boards
- mod+shift+1-9 to jump to board by index
- Uses Mantine useHotkeys (ignores inputs, already in use in the codebase)
@ajnart
ajnart requested a review from a team as a code owner July 18, 2026 16:49
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Board header actions now include keyboard shortcuts for switching between boards. Navigation supports previous and next board cycling and direct selection of up to nine boards, while edit-related controls remain gated by change access.

Changes

Board navigation

Layer / File(s) Summary
Board navigation hotkeys
apps/nextjs/src/app/[locale]/boards/(content)/_header-actions.tsx
Adds board lookup, memoized navigation mappings, previous/next shortcuts, numeric shortcuts for up to nine boards, and route navigation.
Header action integration
apps/nextjs/src/app/[locale]/boards/(content)/_header-actions.tsx
Renders navigation independently of change access while retaining conditional edit menus and read-only settings behavior.

Sequence Diagram(s)

sequenceDiagram
  participant BoardContentHeaderActions
  participant BoardNavigationHotkeys
  participant Router
  BoardContentHeaderActions->>BoardNavigationHotkeys: render navigation component
  BoardNavigationHotkeys->>BoardNavigationHotkeys: query boards and register shortcuts
  BoardNavigationHotkeys->>Router: navigate to selected board
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Yagni / Over-Engineering ⚠️ Warning The PR adds non-trivial hotkey navigation logic, but I found no runnable test/self-check in the touched tree. Add one small runnable check covering next/prev/index navigation, or an assert-based self-check, and keep the implementation lean.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: keyboard shortcuts for switching boards.
Linked Issues check ✅ Passed The PR adds next/previous board shortcuts and board-index jumps, satisfying the linked issue's navigation requirements.
Out of Scope Changes check ✅ Passed The additional header/menu refactor stays tied to exposing board navigation and access handling, with no clear unrelated changes.
Docs Are Up To Date ✅ Passed PR only changes the Next.js board header; no widget/integration docs in apps/docs were needed or changed, so this rule doesn’t apply.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch board-keyboard-shortcuts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/nextjs/src/app/`[locale]/boards/(content)/_header-actions.tsx:
- Around line 226-229: Guard the ArrowRight and ArrowLeft hotkey registrations
in the boards header action flow so they are only added when both boards.length
> 1 and currentIndex !== -1. Preserve the existing wraparound navigation
calculations for valid currentIndex values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8cb723a3-bab8-454b-aed6-3b6c4b6059ea

📥 Commits

Reviewing files that changed from the base of the PR and between ca358d9 and 1609129.

📒 Files selected for processing (1)
  • apps/nextjs/src/app/[locale]/boards/(content)/_header-actions.tsx

Comment on lines +226 to +229
if (boards.length > 1) {
entries.push(["mod+shift+ArrowRight", () => navigateToBoard((currentIndex + 1) % boards.length)]);
entries.push(["mod+shift+ArrowLeft", () => navigateToBoard((currentIndex - 1 + boards.length) % boards.length)]);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Prevent Arrow hotkeys from navigating to unexpected boards when the current board is not found.

If currentIndex evaluates to -1 (e.g., if the current board hasn't synced with the getAllBoards cache yet), the modulo arithmetic will yield incorrect target indices. For instance, if there are 3 boards, pressing "previous" would calculate (-1 - 1 + 3) % 3 = 1 and unexpectedly jump the user to the second board.

Add a check to ensure currentIndex !== -1 before registering the Arrow hotkeys.

🐛 Proposed fix
-    if (boards.length > 1) {
+    if (boards.length > 1 && currentIndex !== -1) {
       entries.push(["mod+shift+ArrowRight", () => navigateToBoard((currentIndex + 1) % boards.length)]);
       entries.push(["mod+shift+ArrowLeft", () => navigateToBoard((currentIndex - 1 + boards.length) % boards.length)]);
     }
📝 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
if (boards.length > 1) {
entries.push(["mod+shift+ArrowRight", () => navigateToBoard((currentIndex + 1) % boards.length)]);
entries.push(["mod+shift+ArrowLeft", () => navigateToBoard((currentIndex - 1 + boards.length) % boards.length)]);
}
if (boards.length > 1 && currentIndex !== -1) {
entries.push(["mod+shift+ArrowRight", () => navigateToBoard((currentIndex + 1) % boards.length)]);
entries.push(["mod+shift+ArrowLeft", () => navigateToBoard((currentIndex - 1 + boards.length) % boards.length)]);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/nextjs/src/app/`[locale]/boards/(content)/_header-actions.tsx around
lines 226 - 229, Guard the ArrowRight and ArrowLeft hotkey registrations in the
boards header action flow so they are only added when both boards.length > 1 and
currentIndex !== -1. Preserve the existing wraparound navigation calculations
for valid currentIndex values.

@Meierschlumpf

Copy link
Copy Markdown
Member

Just had the idea that we could also make a menu like on windows to switch between boards (but of course no need to implement this)

@ajnart

ajnart commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

Just had the idea that we could also make a menu like on windows to switch between boards (but of course no need to implement this)

Like what kind of menu ? The one to switch between spaces ? I think someone opened an issue about it recently

@Meierschlumpf

Copy link
Copy Markdown
Member
image Something like this, just for the boards

@ajnart

ajnart commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

@Meierschlumpf its a good idea

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.

feat: Switch Board via keyboard shortcut

2 participants