Skip to content

feat(shortcuts): record chords with exact modifiers - #1151

Merged
devswha merged 8 commits into
devswha:mainfrom
kratam:feat/shortcut-exact-modifiers
Oct 15, 2026
Merged

devswha merged 8 commits into
devswha:mainfrom
kratam:feat/shortcut-exact-modifiers

Conversation

@kratam

@kratam kratam commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Change

Follows the direction in #798 and the note on #812: scoped on top of the recorder from #951.

  • Exact modifiers in Record. A chord other than Mod+Shift is stored as pressed (meta+PageUp, alt+meta+b, ctrl+k) and shown that way in the row and the palette. A bare stored key still means Mod+Shift, so existing bindings are unchanged.
  • Risky chords, as discussed in feat(settings): record app shortcut bindings by pressing the keys #798:
    • refused: chords the browser, the OS or text editing keeps (Mod+W/T/N, Mod+A/C/V/X/Z, ⌘+Q/H/M and ⌘+` on a Mac, Ctrl+PageUp/PageDown, macOS Ctrl+arrows), a non-Mac Meta chord, and a key without Ctrl, Alt or ⌘;
    • plain Ctrl/Alt (no ⌘): the row warns that the terminal uses it and saves only after Save anyway (Cancel keeps the old binding). This covers Ctrl+K for the palette;
    • a few ⌘ chords the browser commonly uses get a note, but are saved.
  • More keys for Record: Home, End and the punctuation keys. Punctuation is matched by key position (KeyboardEvent.code), so it works on any layout: on a Hungarian keyboard É is the ; key. Letters still match the character typed, so AZERTY keeps its M. Where Chromium exposes the layout map, the row shows the user's own character.
  • The row's dropdown is unchanged. Home, End and punctuation are only available through Record, since a US character in a list would point to a different key on most layouts. A recorded one is listed as itself.

Commits are in order and each builds on the one before; the PR can be squashed.

Validation

  • bun run check fast: generated types, typecheck, build pass. Unit tests: 3748 pass; server/portal.test.ts failed 2 timing tests in the parallel run and passes alone (31/0). This PR does not touch server/.
  • New unit tests in src/lib/shortcuts.test.ts and src/lib/shortcutRecorder.test.ts: exact chord storage and matching, refusals and risks per platform, macOS Option chords, Home/End, position-based punctuation (Hungarian, German, Russian; AZERTY M stays M), the dropdown key list.
  • New browser regression scripts/shortcut-exact-modifiers-demo-regression.ts (added to scripts/ci-browser.sh), on the demo: a safe exact chord is saved and dispatched, Ctrl+K needs Save anyway and Cancel saves nothing, refusals, End via Record shown in the dropdown, a Hungarian É bound by position, the default released after rebinding, from the message box and after a reload. PASS.
  • Used daily on an iPad with a Hungarian hardware keyboard.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VoME51Ex6avEzqEBmkYzGd

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: baa2c2e4-5e0b-4d56-affc-8d140fbb1c90
📥 Commits

Reviewing files that changed from the base of the PR and between 0c03930 and 7c83b86.

📒 Files selected for processing: 12
  • DESIGN.md
  • docs/guide.md
  • docs/terminal-input.md
  • scripts/shortcut-exact-modifiers-demo-regression.ts
  • src/components/SettingsDialog.tsx
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.zh.ts
  • src/lib/shortcutBindings.ts
  • src/lib/shortcutRecorder.test.ts
  • src/lib/shortcuts.test.ts
  • src/lib/shortcuts.ts
🚧 Files skipped from review as they are similar to previous changes: 3
  • src/lib/i18n.ja.ts
  • src/lib/i18n.zh.ts
  • src/lib/i18n.ko.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Record shortcuts with exact modifier combinations, including Ctrl, Alt, and Command, using supported navigation and punctuation keys.
    • Punctuation shortcuts follow physical key positions across keyboard layouts. Risky shortcuts require confirmation before saving, and settings flag potential terminal or browser conflicts.
    • Arrow, Home, and End keys remain available for text selection and movement in text fields.
  • Documentation
    • Updated shortcut guidance with recording, conflict, confirmation, and text-field behavior.
  • Tests
    • Added browser regression coverage for recording, confirmation, dispatch, and persistence after reload.

Shortcut recording now accepts exact modifier chords alongside Mod+Shift shortcuts. The change adds chord validation, risk confirmation, layout-aware matching, settings integration, localized guidance, and browser regression coverage.

Changes: Exact Modifier Shortcuts

Layer / File(s) Summary
Chord contract and recording
src/lib/shortcutBindings.ts, src/lib/shortcutRecorder.ts, src/lib/shortcutRecorder.test.ts
Defines exact chord parsing, formatting, refusal, and risk rules. The recorder accepts valid exact chords and classifies terminal or browser risks. Tests cover chord validity and menu key lists.
Shortcut matching and keyboard layouts
src/lib/shortcuts.ts, src/lib/shortcuts.test.ts
Matches and displays exact chords, compares normalized conflicts, maps punctuation by physical key position, and uses browser layout labels when available. Text fields retain Arrow, Home, and End behavior. Tests cover matching and cross-layout behavior.
Settings, guidance, and browser regression
src/components/SettingsDialog.tsx, src/lib/i18n.*.ts, docs/guide.md, docs/terminal-input.md, docs/development.md, DESIGN.md, changelog.d/shortcut-exact-modifiers.md, scripts/shortcut-exact-modifiers-demo-regression.ts, scripts/ci-browser.sh, scripts/ci-browser.test.ts
Settings requests confirmation before saving risky chords and retains custom bindings in selectors. Documentation and translations describe recording rules. Browser regression checks recording, confirmation, refusal, dispatch, and reload behavior; CI runs the script.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Suggested reviewers: devswha

Merge Risk: ⚪ Minimal · up to 7c83b

No blocking shortcut behavior issue was established; the change is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 48.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 12 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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 clearly and concisely describes the main change: recording shortcuts with exact modifiers.
Description check Passed The description includes the required Change and Validation sections. It explains the new behavior, references related issues, and reports relevant test results, including the isolated timing-test fai…
Full details: Docstring Coverage

Explanation

Docstring coverage is 48.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 12 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

kratam and others added 6 commits October 15, 2026 19:36
Settings → Shortcuts records any chord with Ctrl, Alt or (on a Mac) ⌘, not only
Mod+Shift, following the maintainer's direction in devswha#798. A Mod+Shift chord is
still stored as its bare key. Chords the browser, the OS or text editing keep are
refused; a plain Ctrl or Alt chord, which shells and agents use, is saved only
after Save anyway (as suggested in devswha#798 by a user who wants Ctrl+K).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VoME51Ex6avEzqEBmkYzGd
… every layout

Home, End and the punctuation keys are bound with Record; a recorded one
is listed as itself. A US character in the list would name another key
on most layouts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VoME51Ex6avEzqEBmkYzGd
… on load

Review follow-ups on the exact-modifier recorder:
- a binding on Home or End gives way in a field with text, like the arrows;
- settings drop a stored exact chord the recorder refuses on this platform;
- Cmd+S and Cmd+Option+I/C/U ask before saving, like other browser chords;
- the row's warning is a status region, and Save anyway/Cancel return focus to Record;
- Reset clears a pending confirmation; macOS shows Ctrl as ⌃;
- ko/zh wording follows each dictionary's glossary.
DESIGN.md and docs/terminal-input.md still said every app shortcut is Mod+Shift
and only its final key changes. Record now keeps exact chords: reserved ones are
refused, terminal and common browser chords save only after Save anyway (devswha#798).
@devswha
devswha force-pushed the feat/shortcut-exact-modifiers branch from 0c03930 to 64e4b73 Compare October 15, 2026 10:50
@devswha

devswha commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks @kratam — this follows the direction in #798, so I've carried it over the line on your branch rather than waiting. Your four commits are kept as they were (authorship unchanged), rebased onto current main, with two maintainer commits on top:

fix(shortcuts) – review follow-ups

  • A binding on Home or End now gives way in a text field that has text, the same as the arrows do (Ctrl+Shift+Home used to open the palette instead of selecting).
  • sanitizeShortcutOverrides drops a stored exact chord that the recorder would refuse on this platform, so a hand-edited or imported value can't bind Ctrl+T, Ctrl+PageUp, etc.
  • Cmd+S and Cmd+Option+I/C/U now ask before saving, like the other browser chords.
  • The row's warning is a role="status" region, and Save anyway/Cancel return focus to the row's Record button.
  • Reset clears a pending confirmation. On macOS, Ctrl is shown as ⌃ (the regression script's assertion is updated to match).
  • ko/zh wording now follows each dictionary's glossary.

docs(shortcuts): DESIGN.md and docs/terminal-input.md now describe Mod+Shift as the default rather than the only chord.

Left for follow-ups, since they predate this PR:

  • isVoiceShortcut doesn't skip IME composition (isComposing/229).
  • Some header tooltips hard-code ⌘⇧ keys instead of reading the saved bindings.

Verified locally: bun run check fast passes (3818 unit tests), and so do shortcut-exact-modifiers, key-bar-customization and pane-input-focus demo regressions.

@devswha

devswha commented Oct 15, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha

devswha commented Oct 15, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha

devswha commented Oct 15, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha

devswha commented Oct 15, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha
devswha merged commit 873ebb4 into devswha:main Oct 15, 2026
9 checks passed
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.

2 participants