Skip to content

feat(web): add shift+t keyboard shortcut for theme toggle - #331

Merged
imshashank merged 3 commits into
Noveum:mainfrom
SinghAstra:feat/130-theme-shortcut
Aug 19, 2026
Merged

imshashank merged 3 commits into
Noveum:mainfrom
SinghAstra:feat/130-theme-shortcut

Conversation

@SinghAstra

@SinghAstra SinghAstra commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #130. I noticed this issue had been open without a linked PR for a week, so I went ahead and put the fix together to help clear out the backlog!

Binds shift+d to the view:theme command in navigation.ts.

Updates the View table in docs/keyboard-shortcuts.md.

Adds a unit test in navigation.test.ts asserting the binding.

bun test apps/web/tests/lib/navigation.test.ts is fully green.

Greptile Summary

The PR adds a global Shift+T shortcut for toggling the theme and keeps its test coverage and keyboard-shortcut documentation aligned.

  • Registers shift+t on the existing view:theme command.
  • Adds a unit test asserting the command binding.
  • Documents the new shortcut and refreshes the shortcut-registration example.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/web/src/lib/navigation.ts Adds the supported and currently unclaimed shift+t binding to the existing theme command.
apps/web/tests/lib/navigation.test.ts Adds focused coverage confirming that the theme command exposes the new binding.
docs/keyboard-shortcuts.md Documents Shift+T in the View shortcuts table and updates the illustrative registration example.

Reviews (4): Last reviewed commit: "Merge branch 'main' into feat/130-theme-..." | Re-trigger Greptile

Context used:

@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@SinghAstra is attempting to deploy a commit to the MagicAPI Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 449eb240-a4fc-4ee8-b773-ffac07c77d5c

📥 Commits

Reviewing files that changed from the base of the PR and between a447d5a and 4ef6d85.

📒 Files selected for processing (3)
  • apps/web/src/lib/navigation.ts
  • apps/web/tests/lib/navigation.test.ts
  • docs/keyboard-shortcuts.md

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The theme-toggle command now registers shift+t. Navigation tests verify the binding. Keyboard shortcut documentation lists Shift+T and updates the duplicate-issue example to shift+z.

Changes

Theme Toggle Shortcut

Layer / File(s) Summary
Register and test theme binding
apps/web/src/lib/navigation.ts, apps/web/tests/lib/navigation.test.ts
The view:theme command uses shift+t. A global command test verifies the binding.
Update shortcut documentation
docs/keyboard-shortcuts.md
The View shortcuts list Shift+T. The duplicate-issue example uses shift+z.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 4ef6d

This localized keyboard-shortcut change adds and documents theme toggling with a unit test; no actionable merge-blocking risk remains in the supplied evidence.

Suggested reviewers: pulkitxm, imshashank

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The documentation changes the issue-duplication shortcut from Shift+D to Shift+Z, which is unrelated to the implemented Shift+T theme shortcut. Remove the unrelated issue-duplication shortcut change unless separate requirements justify it.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds, documents, and tests a theme-toggle binding; the reported Shift+D conflict does not apply to the implemented Shift+T binding.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The description explains the theme-toggle shortcut, documentation update, test coverage, and verification, despite one incorrect reference to Shift+D.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the Shift+T theme-toggle shortcut.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added documentation Docs, the README, or anything that explains Orbit tests Test coverage and test infrastructure area: web The Next.js app and its UI labels Aug 17, 2026
Comment thread apps/web/src/lib/navigation.ts Resolved
@imshashank

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@imshashank imshashank left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for picking this up unprompted. #130 had sat for a week and you found it and fixed it without being asked, which is exactly the contribution pattern I want, and the shape of the change is right: one binding, one doc update, one test.

There is one real problem, and it is not quite the one Greptile described.

Shift+D is already taken, and the theme toggle wins

apps/web/src/features/issues/issue-properties.tsx:107 already binds shift+d to the due date menu, and the UI advertises it: <PropertyRow label="Due date" shortcut="shift+d">.

Greptile said the theme shortcut would not reliably fire on issue pages. I checked against the real registry and it is the other way round, which is worse. Both entries register at priority: 0. The issue one passes scope: 'issues' but no priority, so it falls back to HOTKEY_PRIORITY.global. In beats() the two are identical on all three tiebreakers: one step each, same priority, one shift each. So beats returns false, selectMatch keeps whichever it saw first, and that is the command palette's entry, because the palette mounts with the shell before any issue page exists.

I ran it against HotkeyRegistry and selectMatch directly rather than reasoning about it:

WINNER: Switch theme / palette-theme

So after this change, pressing Shift+D on an issue detail page toggles the theme and the due date menu no longer opens. An existing, advertised, documented shortcut stops working, and nothing in the test suite notices.

Suggested fix

Use shift+t. I inventoried every binding in the app and it is free:

useHotkey:  ] a alt+shift+f alt+v escape f i j k l m p s shift+d shift+e shift+f shift+j shift+k
palette:    ? [ g a g d g i g m g p g r g s g t g v
aliases:    up down shift+up shift+down

It is mnemonic for theme, it does not collide, and g t is a two step sequence so it does not interfere. Swap the binding, update the docs row, and this is done.

If you would rather keep shift+d for the theme, that is a bigger conversation: it would mean deliberately taking a key off the issue surface and rebinding due date, and I would want that argued on its own rather than as a side effect.

Smaller things

Three minor items inline. None of them are blocking on their own.

Once the binding changes, this is a quick approve from me. Sorry you waited a day on it, the answer turned out to be one word.

Comment thread apps/web/src/lib/navigation.ts Outdated
label: context.dark ? 'Switch to light theme' : 'Switch to dark theme',
section: 'View',
icon: context.dark ? Sun : Moon,
binding: 'shift+d',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the collision. issue-properties.tsx:107 already registers shift+d for the due date menu, and issue-properties.tsx:277 advertises it in the UI as the due date shortcut.

Both register at HOTKEY_PRIORITY.global, because the issue one sets scope: 'issues' but never sets priority, and scope does not participate in beats(). With equal step count, equal priority and equal shift specificity, beats() returns false and selectMatch keeps the first entry it encountered. The palette registers on shell mount, before any issue page, so the theme command wins and the due date shortcut silently stops opening its menu.

I confirmed this against the real HotkeyRegistry rather than reading it off the rules: registering both and calling selectMatch returns Switch theme / palette-theme.

shift+t is free and mnemonic. Changing this one line and the docs row fixes it.

Worth noting for future work: the registry silently resolves a tie rather than complaining about it, which is how this got past review. A duplicate binding check in the registry, or a test that asserts no two advertised entries share a binding, would catch the next one automatically. That is out of scope here, and I will open an issue for it.

Comment thread apps/web/tests/lib/navigation.test.ts Outdated
const commands = buildCommands(context);
const themeCommand = commands.find((cmd) => cmd.id === 'view:theme');
expect(themeCommand).toBeDefined();
expect(themeCommand?.binding).toBe('shift+d');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This asserts the metadata rather than the behaviour, so it passes whether or not the shortcut actually works. It would have passed unchanged with the collision in place, which is the definition of a test that cannot fail for the thing it is meant to protect.

What would earn its keep: build a HotkeyRegistry, register the palette command alongside a scope: 'issues' entry on the same key, and assert selectMatch picks the one you intend. That is the assertion that breaks the day somebody adds a third shift+t.

The fixture construction here is good, and CommandContext being explicit rather than cast is the right instinct.

Comment thread docs/keyboard-shortcuts.md Outdated

The theme toggle has no key of its own. Run it from the command palette.
| <kbd>]</kbd> | Toggle the right panel |
| <kbd>Shift</kbd> <kbd>D</kbd> | Switch between light and dark theme |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two things in this file.

The row is correct once the binding moves, so it just needs Shift T instead.

More importantly, this file now contradicts itself. Line 149, in the "Adding one" section, uses useHotkey('shift+d', duplicateIssue, ...) as the worked example for registering a shortcut. So the same document tells a reader that Shift+D is the theme toggle and, thirty lines later, that it is duplicate issue. Whichever key this lands on, please pick a key for that example that is not bound to anything real, so the example cannot go stale again.

Also a stray edit: line 119 picked up two trailing spaces after Toggle the right panel. Worth dropping before merge, since trailing whitespace in a table cell is invisible in review and shows up in the next diff that touches the line.

@imshashank

Copy link
Copy Markdown
Contributor

Opened #332 for the underlying gap, since the registry resolving a tie silently is what let this through review rather than anything you did. Tagged good first issue if you want it after this one.

Binds shift+d to the view:theme command to allow toggling light and dark mode without opening the command palette. Updates shortcut documentation and adds a unit test asserting the binding.

Closes Noveum#130
@SinghAstra
SinghAstra force-pushed the feat/130-theme-shortcut branch from 458130a to 4ef6d85 Compare August 18, 2026 15:51
@SinghAstra SinghAstra changed the title feat(web): add shift+d keyboard shortcut for theme toggle feat(web): add shift+t keyboard shortcut for theme toggle Aug 18, 2026
@SinghAstra

Copy link
Copy Markdown
Contributor Author

Pushed the fix!

  1. Changed the binding to shift+t in navigation.ts and navigation.test.ts.

  2. Updated the View table to Shift+T in the docs.

  3. Changed the duplicateIssue example key to shift+z in the docs so it doesn't drift.

  4. Dropped the trailing whitespace on line 119.

Good catch on selectMatch! I see you opened #332 for the underlying architecture fix, so I kept this PR strictly to the Theme toggle shortcut to stay in scope.

@imshashank imshashank left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All three addressed, and the docs example fix is the one I care most about: moving that snippet to shift+z means the worked example is no longer describing a key that is really bound to something else, so it cannot drift into a real conflict again. I checked shift+z against the full binding inventory and it is free.

Verified locally: shift+t does not collide with anything, apps/web typechecks clean, and tests/lib/navigation.test.ts is 6 pass 0 fail.

On my second comment, the one asking for a registry level test rather than a metadata assertion: you have effectively answered it in #334 by testing the registry directly, which is the better place for it. Keeping the metadata assertion here is fine, since what this PR owns is the choice of key rather than the resolution behaviour.

Thanks for turning this around quickly, and for finding the issue yourself in the first place.

@imshashank

Copy link
Copy Markdown
Contributor

Green now. The Unit and integration tests failure you saw here was never yours: #323 had added a test that set BETTER_AUTH_SECRET at module scope, which changed it for the whole test process and broke MCP token verification in MCP authorize PKCE boundary. The Playwright job then aborted as a knock-on rather than failing on its own. Fixed in #338 and main is green again.

Merging this. Thanks for the fix and for the follow up in #334.

@imshashank
imshashank merged commit 6c6f3d9 into Noveum:main Aug 19, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: web The Next.js app and its UI documentation Docs, the README, or anything that explains Orbit tests Test coverage and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The theme toggle has no keyboard shortcut

2 participants