Conversation
1170222 to
07875d2
Compare
a97b90b to
832c8ac
Compare
There was a problem hiding this comment.
Pull request overview
This PR switches “workspace” action/context menus in the Lite UI from Base UI’s in-DOM menus to Electron-native popup menus, wired through a new IPC endpoint.
Changes:
- Replaced
@base-ui/reactMenu/ContextMenuusage in the workspace route with native-menu triggers and item definitions. - Added a renderer-side native menu helper (
native-menu.ts) that serializes menu items and dispatches selection handlers. - Added an Electron IPC handler (
lite:show-native-menu) plus preload/api typing to display a nativeMenu.popup()and return the selected item id.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/lite/ui/src/routes/project/$id/workspace/route.tsx | Replaces Base UI menus with calls to showNativeContextMenu / showNativeMenuFromTrigger and inline NativeMenuItem[] definitions. |
| apps/lite/ui/src/routes/project/$id/workspace/route.module.css | Removes :has(...aria-expanded="true") styling hook that no longer applies with native menus. |
| apps/lite/ui/src/native-menu.ts | Adds renderer-side menu item serialization + IPC call to show a native menu and run the selected handler. |
| apps/lite/electron/src/preload.cts | Exposes showNativeMenu on window.lite via ipcRenderer.invoke. |
| apps/lite/electron/src/main.ts | Implements lite:show-native-menu handler using Electron Menu.popup() and a template builder. |
| apps/lite/electron/src/ipc.ts | Adds IPC types (NativeMenuPopupItem, ShowNativeMenuParams, etc.) and channel constant. |
832c8ac to
8e6a011
Compare
8e6a011 to
7f2a5f6
Compare
07875d2 to
149a006
Compare
7f2a5f6 to
1dbb055
Compare
1dbb055 to
7d46870
Compare
7d46870 to
a05a1dc
Compare
| <button | ||
| type="button" | ||
| className={styles.itemRowAction} | ||
| aria-label={`${change.path} menu`} |
There was a problem hiding this comment.
This menu trigger is now a plain <button>; Menu.Trigger previously handled menu-related ARIA. Add aria-haspopup="menu" (and any other necessary ARIA attributes) so screen readers can identify this as opening a menu.
| aria-label={`${change.path} menu`} | |
| aria-label={`${change.path} menu`} | |
| aria-haspopup="menu" |
| <button | ||
| type="button" | ||
| className={styles.itemRowAction} | ||
| aria-label="Changes menu" |
There was a problem hiding this comment.
This button triggers a menu but lacks aria-haspopup="menu" now that it’s not using Menu.Trigger. Adding the appropriate ARIA attributes will prevent an accessibility regression for assistive technology users.
| aria-label="Changes menu" | |
| aria-label="Changes menu" | |
| aria-haspopup="menu" |
| <button | ||
| type="button" | ||
| className={styles.itemRowAction} | ||
| aria-label="Branch menu" |
There was a problem hiding this comment.
Since this button opens the branch menu via the native menu API, it should expose menu semantics (e.g., aria-haspopup="menu") that were previously supplied by Menu.Trigger to avoid an accessibility regression.
| aria-label="Branch menu" | |
| aria-label="Branch menu" | |
| aria-haspopup="menu" |
| <button | ||
| type="button" | ||
| className={styles.itemRowAction} | ||
| aria-label="Stack menu" |
There was a problem hiding this comment.
This stack menu trigger is now a plain button; Menu.Trigger previously provided menu-related ARIA attributes. Add aria-haspopup="menu" (and any other required ARIA attributes) so assistive technologies can recognize it as a menu trigger.
| aria-label="Stack menu" | |
| aria-label="Stack menu" | |
| aria-haspopup="menu" |
| const handlers = new Map<string, NativeMenuAction | undefined>(); | ||
| const serializedItems = serializeNativeMenuItems(items, handlers, { value: 0 }); | ||
|
|
There was a problem hiding this comment.
serializeNativeMenuItems expects a Map<string, NativeMenuAction | undefined>, but showNativeMenu constructs handlers as new Map<string, NativeMenuAction>() and passes it in. Because Map is invariant in its value type, this is a TypeScript type error (and it’s also inconsistent with handlers.set(itemId, item.onSelect) where onSelect can be undefined). Make handlers a Map<string, NativeMenuAction | undefined> (or only allocate itemId/store handlers for items that actually have an onSelect).
| @@ -0,0 +1,84 @@ | |||
| import type { NativeMenuPopupItem, NativeMenuPosition } from "#electron/ipc.ts"; | |||
| import { MouseEvent } from "react"; | |||
There was a problem hiding this comment.
MouseEvent is only used as a type here. Prefer import type { MouseEvent } from "react"; to avoid introducing/keeping a runtime React import unnecessarily in this utility module (especially under isolatedModules/Vite transforms).
| import { MouseEvent } from "react"; | |
| import type { MouseEvent } from "react"; |
| <button | ||
| type="button" | ||
| className={styles.itemRowAction} | ||
| aria-label="Commit menu" |
There was a problem hiding this comment.
This button opens a menu, but it no longer gets the ARIA semantics that Menu.Trigger previously provided. Consider adding aria-haspopup="menu" (and any other required ARIA attributes your a11y baseline expects) so assistive tech can announce it as a menu trigger.
| aria-label="Commit menu" | |
| aria-label="Commit menu" | |
| aria-haspopup="menu" |
No description provided.