Skip to content

[KS] Menus: keep localized native root titles; exact Shift shortcuts (#449, #450) - #455

Merged
sethwebster merged 2 commits into
seth/kitchen-sink-gatefrom
seth/ks-449-menu-fixes
Oct 13, 2026
Merged

sethwebster merged 2 commits into
seth/kitchen-sink-gatefrom
seth/ks-449-menu-fixes

Conversation

@sethwebster

Copy link
Copy Markdown
Collaborator

Refs #449, Refs #450

#449: located roots replaced the system's localized menu title

RNNativeMenu applied a root's label as the title of the native root it located with target: { menu } (Window, Help, ...), replacing e.g. "نافذة"/"Fenêtre". A native root now keeps its own title; the label names only a root Spark creates when it is missing (a later owner's label can retitle that one, matching the Windows composer). Documented in docs/menus.md.

#450: ⌘⇧N fired nothing under the driver

Root cause (standalone AppKit probes, macOS 27): Spark published Cmd+Shift+N as key equivalent n with a Shift mask. Hardware (CGEvent-backed) events match that correctly. Key events made with +[NSEvent keyEventWithType:], which the in-app driver uses, are matched by their characters with Shift ignored: n+⇧⌘ ran on ⌘N and did nothing on ⌘⇧N. File ▸ New (⌘N) does not catch ⌘⇧N either; the issue's probe used charactersIgnoringModifiers: n, which neither hardware nor the driver produces. The driver bypasses local event monitors, so the shortcut map's router never sees driver keys and only the menu item can fire. Setting the keyboard type on the synthesized event did not change matching.

Fix: a Shift+letter shortcut is published as AppKit's uppercase key equivalent (N with ⇧⌘), which matches only the shifted press for both driver and hardware events. Documented in docs/menus.md.

Tests

  • tests/application-menu.native.mm: localized Edit and Window roots keep their titles; a created root uses its label and a later owner retitles it; File ▸ New ⌘N + published ⌘⇧N: the published key is N, ⌘⇧N (synthesized and CGEvent) runs only New note, ⌘N runs only File ▸ New. Each part failed with its fix reverted (Edit menu lost its localized title; Shift shortcut did not use AppKit's uppercase key equivalent, and with only that assertion removed, Shift-Command-N did not run New note).
  • New driver flow e2e/flows/menus/macos-localized-root.yaml (check MENU-ROOT-01, en/ar/fr): Menu Audit's Help contribution lands in مساعدة / Aide, with no English Help root.

Verification

Run this session on macOS 27:

  • bun run typecheck: clean. bun run e2e:lint: 0 problems (342 files).
  • bun run test: 1982 passed, 2 failed, both accepted: tests/node-runtime.test.ts (asdf node shim) and tests/motion-native.test.ts (frames check while the display sleeps).
  • ks-lock native bun run e2e:run e2e/flows/menus e2e/flows/keyboard e2e/flows/internationalization e2e/flows/infra/catalog-driver.yaml --backend driver on a dev build with both fixes: 37 passed, 3 failed, 2 skipped (Windows). Passed include keyboard/shortcut-map-rebind, menus/macos-localized-root (en, ar, fr), menus/macos-shortcut-takeover, internationalization/native-strings (en, ar, fr) and infra/catalog-driver (4). Failed: menus/macos-help and menus/macos-items (×2), which use black-box-only steps (searchHelpMenu, assertMenuItem) the driver reports unsupported, as on the base.
  • Same driver run of macos-localized-root and shortcut-map-rebind on a dev build with the base RNNativeMenu.mm: ar and fr fail ("مساعدة" is not in [..., Help, ...], "Aide" is not in [..., Help, ...]), and rebind fails as reported in [KS][KEY] shortcut-map-rebind: ⌘⇧N fires nothing under the driver #450.
  • Not run: black-box (ks-lock gui) runs.

…it (#449)

A root with target { menu } merged into an existing native menu and set its
title to the label, replacing the system's localized title (ar, fr). The label
now names only a root Spark creates.
…ts (#450)

AppKit matches a lowercase key equivalent to a key event made with
keyEventWithType: (the test driver's) by its characters, ignoring Shift, so a
published Cmd+Shift+N ran on Cmd+N and not on Cmd+Shift+N. The uppercase form
matches only the shifted press, for driver and hardware events.
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.

1 participant