fix: let the native context menu through where text is selectable - #27
fix: let the native context menu through where text is selectable#27ashproto wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A window-level handler cancelled every native context menu in the app. The handful of row types with their own menu already call preventDefault themselves, so all it did elsewhere was take functionality away: right-clicking a commit-message box, a review textarea, diff code, or rendered Markdown gave nothing at all — no Copy, Paste, Look Up, or spelling. On macOS that reads as broken. The intent was presumably to hide WebKit's developer menu, but `devtools` is not in the Tauri feature list, so the inspector only exists on debug builds and never ships. Nothing needed guarding in release. Rather than invent a second notion of "editable or selectable", read the computed `user-select`: the stylesheet right below already curates that set, opting a no-select body back in for form fields, diff code, rendered markdown, commit bodies and `.sha`. It inherits, so descendants of `.md`/`.selectable` are covered without enumerating them, and DiffView's gutter — which sets its own `user-select: none` so gutter-drag staging never selects text — keeps suppressing its menu for free. Both the prefixed and unprefixed properties are read: minimumSystemVersion is 12.3, where unprefixed support is not a given. Verified by running the handler against the live stylesheet: chrome, nested toolbar spans and the gutter suppress; input, textarea, .md and its descendants, .diff-cell, .sha, .body-msg and deep .selectable children get the native menu. What that menu RENDERS is a WKWebView decision no test environment reproduces, so it still wants a look in a bundled build. npm run check 524 files 0 errors; npm test 330 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
💡 Codex Reviewgit-it/src/lib/updater.svelte.ts Lines 152 to 156 in 3513a50 When an automatic check completes while Settings, Manage Repository, amend/rebase, branch-color, or a GitHub action modal is open, ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Reported by Codex review on #26 as P2. The code is not part of that PR —
src/routes/+page.svelte:298came from15e51c3(2026-07-17), and #26 only ever touched that file to add a--diff-ringtoken — so it is fixed here on its own branch.The problem
A window-level handler cancelled every native context menu in the app:
Right-clicking a commit-message box, a PR review textarea, diff code, or rendered Markdown gave nothing at all — no Copy, no Paste, no Look Up, no spelling suggestions. On macOS that reads as broken.
Two findings that made this smaller than it looked
The intent was already satisfied by the build config. The handler was presumably written to hide WebKit's developer menu (Reload / Inspect Element). But
src-tauri/Cargo.tomldeclarestauri = { version = "2", features = ["macos-private-api"] }— nodevtoolsfeature. Tauri enables the inspector on debug builds only, so "Inspect Element" never appears in a release build. Nothing needed guarding in the shipped app.The global handler was not what made the custom menus work. Every one of them already calls
preventDefault()itself —GraphHistory.svelte:247,Sidebar.svelte:238,WorktreePanel.svelte:67, and theWorkingCopyView/RefTreecallbacks. Removing it would not have produced two stacked menus.The fix
The stylesheet immediately below the handler already curates where text matters — a no-select body, opted back in for form fields,
.diff-cell,.md,.body-msg,.sha,.selectable. That set is, near enough by definition, where a native menu earns its place. So the handler reads the computed value rather than keeping a second list in sync with it:user-selectinherits, so descendants of.md/.selectableare covered without enumerating them, andDiffView's line-number gutter — which sets its ownuser-select: noneso gutter-drag staging never selects text — keeps suppressing its menu for free. Both the prefixed and unprefixed properties are read:minimumSystemVersionis 12.3 (Monterey / Safari 15.x), where unprefixed support is not a given.Design doc:
docs/superpowers/specs/2026-08-08-context-menu-scoping-design.md.Behavior
user-select: none)Verification
Ran the handler against the live stylesheet in the dev server and dispatched
contextmenuat each shape:noneinput,textareatext.md+ descendants,.diff-cell,.sha,.body-msg, deep.selectablechildtextStill wants a human look: what WKWebView actually renders for that menu is a decision no test environment reproduces. The gate logic above is verified; the rendered menu is not. Worth a right-click in a bundled build before merging — and note a debug build legitimately shows "Inspect Element" there, which the shipped app will not.
Gates:
npm run check524 files / 0 errors ·npm test330 passed ·cargo testunaffected (TS-only change; the one failure on this branch is thegit_ops.rs:356init-repo flake that #25 fixes).Rejected alternatives
🤖 Generated with Claude Code