Skip to content

fix(keybindings): AltGr-safe default for Add Review Note - #9257

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/addreviewnote-altgr-safe
Jul 18, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/addreviewnote-altgr-safe

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

editor.addReviewNote defaulted to Mod+Alt+N, which resolves to Ctrl+Alt+N = AltGr on Windows/Linux. On diacritic keyboard layouts, AltGr+<letter> types a real character — e.g. on Polish layouts AltGr+N produces ń. An editor-scope default must not reserve that chord family.

Fix

Switch the default to Mod+Shift+A — AltGr-safe, free across Orca keybinding scopes, and mnemonic (A for annotate). The same default is used on every platform for consistency.

Scope note

This is not part of PR #9240 (the tab-switch keybinding swap) despite an earlier triage note conflating the two. It is a different action and has its own runtime and end-to-end coverage.

Regression review

  • Updated every unit and Electron end-to-end caller that still pressed the old chord.
  • Verified real keystroke matching on macOS, Linux, and Windows; Ctrl+Alt+N no longer matches the action on Windows/Linux.
  • Verified all three editor surfaces still open the composer and that no-selection presses remain unconsumed.
  • Audited the input hot path: this remains one static binding through the existing O(1) matcher, with no new listeners, subscriptions, polling, IPC, or allocations.

Tests

  • 95/95 unit tests across:
    • keybindings.test.ts
    • editor-shortcuts.test.ts
    • markdown-preview-annotation-shortcut.test.ts
    • rich-markdown-key-handler.test.ts
  • 4/4 Electron end-to-end tests in markdown-add-review-note-shortcut.spec.ts
  • Node, CLI, and web typecheck pass.
  • Changed-file oxlint, react-doctor, oxfmt, and git diff --check pass.

The editor.addReviewNote default was Mod+Alt+N, which resolves to
Ctrl+Alt+N (AltGr) on Windows/Linux. On diacritic layouts AltGr+N
types a real character (e.g. Polish n-acute), so the editor-scope
chord hijacked normal typing. Switch the default to Mod+Shift+A,
which is AltGr-safe and keeps a mnemonic (A for annotate).
@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The default editor.addReviewNote shortcut changes from Mod+Alt+N to Mod+Shift+A, with comments documenting the keyboard-layout rationale. Shared keybinding expectations, renderer shortcut tests, markdown preview fixtures, inline shortcut documentation, and end-to-end scenarios are updated to reflect the new default while retaining override and event-consumption assertions.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description has useful content, but it does not follow the repository's required template or include the requested section headings. Rewrite it using Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes, and fill in the checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and matches the main change: switching the Add Review Note keybinding to an AltGr-safe default.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@brennanb2025
brennanb2025 merged commit d153295 into main Jul 18, 2026
1 check passed
AmethystLiang added a commit that referenced this pull request Jul 19, 2026
…hord gaps

- Update the product-B guard tests to the Mod+Shift+A default binding
  (#9257 retired Mod+Alt+N as AltGr-unsafe); they asserted the old chord,
  so seven landed red and the rich-editor repeat test passed vacuously.
- Monaco: recompute the annotation target from the live selection at
  keydown instead of the render-lagged ref, so a chord right after a drag
  cannot open on the previous selection or miss a fresh one.
- Preview: key the stale-block-key cleanup on renderedContent (the DOM
  the block keys live in), which can lag content during external-edit
  section preservation.

Co-authored-by: Orca <[email protected]>
AmethystLiang added a commit that referenced this pull request Jul 19, 2026
* Guard add-review-note chord to prevent remount (product B)

- Scoped guards consume chord at composer level to prevent remount and leakage
- Handle OS key-repeat: ignore when no draft, consume when one is mounted
- Clear stale block keys in markdown preview when content renumbers
- Flush pending selection before reading targets to fix timing races

* fix(editor): repair add-review-note guard tests and close remaining chord gaps

- Update the product-B guard tests to the Mod+Shift+A default binding
  (#9257 retired Mod+Alt+N as AltGr-unsafe); they asserted the old chord,
  so seven landed red and the rich-editor repeat test passed vacuously.
- Monaco: recompute the annotation target from the live selection at
  keydown instead of the render-lagged ref, so a chord right after a drag
  cannot open on the previous selection or miss a fresh one.
- Preview: key the stale-block-key cleanup on renderedContent (the DOM
  the block keys live in), which can lag content during external-edit
  section preservation.

Co-authored-by: Orca <[email protected]>

* fix(editor): mirror shortcut-guard refs in effects instead of render body

CodeRabbit on #9412: render-body ref writes can leak from a render pass
React replays and discards. Move the state->ref mirrors for
commentPopoverRef / shouldShowMarkdownAnnotationsRef (MonacoEditor) and
activeAnnotationBlockKeyRef (MarkdownPreview) into effects; same-tick
keydown paths keep their eager event-handler writes.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Orca <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(keybindings): use AltGr-safe default for Add Review Note

The editor.addReviewNote default was Mod+Alt+N, which resolves to
Ctrl+Alt+N (AltGr) on Windows/Linux. On diacritic layouts AltGr+N
types a real character (e.g. Polish n-acute), so the editor-scope
chord hijacked normal typing. Switch the default to Mod+Shift+A,
which is AltGr-safe and keeps a mnemonic (A for annotate).

* test(keybindings): cover Add Review Note chord end to end
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Guard add-review-note chord to prevent remount (product B)

- Scoped guards consume chord at composer level to prevent remount and leakage
- Handle OS key-repeat: ignore when no draft, consume when one is mounted
- Clear stale block keys in markdown preview when content renumbers
- Flush pending selection before reading targets to fix timing races

* fix(editor): repair add-review-note guard tests and close remaining chord gaps

- Update the product-B guard tests to the Mod+Shift+A default binding
  (stablyai#9257 retired Mod+Alt+N as AltGr-unsafe); they asserted the old chord,
  so seven landed red and the rich-editor repeat test passed vacuously.
- Monaco: recompute the annotation target from the live selection at
  keydown instead of the render-lagged ref, so a chord right after a drag
  cannot open on the previous selection or miss a fresh one.
- Preview: key the stale-block-key cleanup on renderedContent (the DOM
  the block keys live in), which can lag content during external-edit
  section preservation.

Co-authored-by: Orca <[email protected]>

* fix(editor): mirror shortcut-guard refs in effects instead of render body

CodeRabbit on stablyai#9412: render-body ref writes can leak from a render pass
React replays and discards. Move the state->ref mirrors for
commentPopoverRef / shouldShowMarkdownAnnotationsRef (MonacoEditor) and
activeAnnotationBlockKeyRef (MarkdownPreview) into effects; same-tick
keydown paths keep their eager event-handler writes.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Orca <[email protected]>
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