Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): theme context menus on Windows and Linux #6440

ClosedStiensWout(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/6440/headopened View on GitHub

Summary

Desktop context menus currently use Electron's native renderer on every platform, so Windows and Linux do not follow T3's themed menu surface. This keeps macOS native for now and routes web, Windows, and Linux through the existing renderer fallback.

The platform decision is covered by focused tests for browser, Windows, Linux, and macOS behavior. The fallback test also verifies themed menu classes, variables, and keyboard navigation.

Verification

  • pnpm --filter @t3tools/web test -- src/localApi.test.ts src/contextMenuFallback.test.ts (web unit suite: 245 files, 2,385 tests passed)
  • pnpm --filter @t3tools/web typecheck
  • vp lint apps/web/src/localApi.ts apps/web/src/localApi.test.ts apps/web/src/contextMenuFallback.test.ts
  • vp fmt --check apps/web/src/localApi.ts apps/web/src/localApi.test.ts apps/web/src/contextMenuFallback.test.ts
  • Playwright right-click capture from an isolated T3 preview using the Ocean dark theme and 18 px interface font

Before

Native context menu before

After

Themed Ocean context menu captured with Playwright at 18 px

Model/harness: GPT-5.6 via the Codex harness.


Note

Medium Risk Changes visible context-menu behavior on Windows/Linux desktop and adds non-trivial focus/keyboard logic, though scope is limited to menu UI and is covered by new tests.

Overview Windows and Linux desktop apps now use the in-renderer showContextMenuFallback for context menus so they pick up T3 theme tokens; macOS still uses the Electron desktopBridge native menu via new isMacOSHost() gating in localApi.

The fallback menu gains keyboard navigation (arrows, Home/End, Enter/Space, Escape), nested submenu open/close with aria-expanded, focus restore on dismiss and after selection, and pointer hover kept in sync with focus. Menus expose role="menu" / menuitem and themed styling assertions in tests.

localApi.test.ts adds platform-specific routing tests; contextMenuFallback.test.ts extends the fake DOM for focus/keyboard coverage.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f4427822ff9df4449aed8503573d7ef823bc54de. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Use themed context menu fallback on Windows and Linux instead of native desktop bridge

  • On Windows and Linux, createBrowserLocalApi.contextMenu.show now routes to showContextMenuFallback even when a desktop bridge is present; macOS continues to use the native bridge via the new isMacOSHost helper in localApi.ts.
  • showContextMenuFallback in contextMenuFallback.ts gains full keyboard navigation (Arrow keys, Home/End, Enter/Space), nested submenu open/close via ArrowRight/ArrowLeft, ARIA roles and attributes, hover/focus alignment, and focus restoration on close.
  • Behavioral Change: desktop builds on Windows and Linux no longer call the native context menu bridge, so menus will render with the themed web fallback rather than OS-native styling.
Macroscope summarized f442782.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: e532de4d-f06d-4a30-a2a3-82b1b3a685f1

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      1 blocking correctness issue found. This PR changes context menu behavior on Windows and Linux to use a themed fallback implementation instead of native Electron menus. While the keyboard navigation concern was addressed and tests are comprehensive, the behavioral change to how menus work on non-macOS platforms warrants human verification of the UX implications.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Fixed in 0c0dc22c1: renderer menus now focus the first enabled item, support Arrow/Home/End navigation, Enter/Space activation, and nested submenu Right/Left navigation with visible focus styling. Added focused keyboard-navigation tests.

    5. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 889a4b10ce8bb030758431cf1c9e77f02a2bf258. Configure [here](https://www.cursor.com/dashboard/bugbot).
    6. Windows review. Electron's native menu follows light/dark, not --accent / the T3 theme. Forcing the renderer fallback on Win32/Linux (keep native on MacIntel) is the right split.

      localApi.test.ts + contextMenuFallback.test.ts: 18/18, including explicit Win32 and Linux cases that assert desktopBridge.showContextMenu is not called.

      CONFLICTING against current main — rebase before merge. I did not right-click in a running desktop build.

Sign in to join this conversation.