Skip to content

fix(shortcuts): leave Mod+Shift+arrows to text fields, and open New session with Mod+Shift+O - #298

Merged
devswha merged 3 commits into
mainfrom
fix/shortcut-keys
Oct 2, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/shortcut-keys

Conversation

@devswha

@devswha devswha commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Change

The bugs reported in #214, checked again on main first:

  1. Pane switching leaking ESC[1;6B into the terminal: already fixed by fix(terminal): app shortcuts no longer type into the pane #215. Checked in headless Chrome against an isolated herdr: Ctrl+Shift+↓ in pane A's terminal switched to pane B, and neither pane (both running cat -v) received anything; what was typed next landed in B.
  2. New session (Mod+Shift+N) never reaching the page in a Chrome tab: Chrome reserves Ctrl+Shift+N for a new incognito window. Mod+Shift+O now opens New session too, and is the one the app shows; Mod+Shift+N still works where the browser passes it (the installed app). Checked: Ctrl+Shift+O in the terminal opens the New session dialog and types nothing into the pane.
  3. Cmd+Shift+↑/↓ taken from the message box on a Mac: reproduced with a Mac platform in headless Chrome: the shortcut switched panes and left the message behind. useShortcuts now leaves Mod+Shift+arrows to text fields (textarea, text inputs, contenteditable) and switches panes from the terminal (xterm's own input element) and everywhere else. Checked: the same key in the message box no longer switches panes.

The configurable shortcuts that #214 proposes are not part of this; the issue stays open for them.

Validation

  • Playwright against an isolated herdr session, as above.
  • src/lib/shortcuts.test.ts: which targets keep the arrows, and both new-session keys.
  • bun run typecheck, bun run test:unit, bun run build.
  • Not checked: a real Mac (the platform was set in the page) and a real Chrome tab's reserved keys (headless Chrome passes every key to the page).

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
CONTRIBUTING.md — configured

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: 6862c779-3e1d-4035-a5af-34e0d598bc91

📥 Commits

Reviewing files that changed from the base of the PR and between f35aeae and a2db4a3.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • docs/guide.md
  • src/lib/shortcuts.test.ts
  • src/lib/shortcuts.ts

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


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Pane-switching shortcuts no longer interrupt text selection or arrow-key navigation in editable fields. They continue to switch panes from the terminal and other non-editable areas.
  • Documentation

    • Updated the New session shortcut documentation to include Mod+Shift+O; Mod+Shift+N remains supported.

Walkthrough

The New session shortcut now uses Mod+Shift+O, while Mod+Shift+N remains available. Pane-switch shortcuts leave arrow keys available for recognized text-editing targets. The changelog and guide document these shortcut behaviors.

Changes

Keyboard shortcuts

Layer / File(s) Summary
New session shortcut mapping
src/lib/shortcuts.ts, src/lib/shortcuts.test.ts, docs/guide.md, CHANGELOG.md
The New session shortcut changes to Mod+Shift+O, and Mod+Shift+N remains mapped to the action. Tests cover both mappings. The guide and changelog document the shortcuts.
Pane-switch handling for text targets
src/lib/shortcuts.ts, src/lib/shortcuts.test.ts, CHANGELOG.md
keepsArrowsForText identifies supported editable targets and excludes xterm’s helper textarea. useShortcuts does not intercept pane-switch shortcuts for those targets. Tests cover target types, and the changelog describes the text-selection behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: ddotz

Merge Risk: ⚪ Minimal · up to a2db4

The shortcut changes are mergeable after normal checks. Real-Mac and browser-reserved-key behavior has not been validated, but no specific failure is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies both primary shortcut changes: preserving Mod+Shift+arrow behavior in text fields and using Mod+Shift+O for New session.
Description check ✅ Passed The description includes the required Change and Validation sections. It explains the problems, resulting behavior, test coverage, and known validation limitations. It does not include a screenshot or…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@devswha
devswha merged commit d9fd0a5 into main Oct 2, 2026
3 checks passed
@devswha
devswha deleted the fix/shortcut-keys branch October 2, 2026 05:10
devswha added a commit that referenced this pull request Oct 11, 2026
…sage box (#827)

## Change

Mod+Shift+↑/↓ switch panes from the terminal view, but not from the chat
view. The chat view puts the focus in the message box, and #298 leaves
Mod+Shift+arrows to every text field (`keepsArrowsForText`), so in chat
the shortcut never reaches `selectAdjacentPane`.

#298 kept the arrows in the message box for two reasons: they select
text, and switching would leave a message behind. An empty field has
neither, so `keepsArrowsForText` now returns `false` when the target's
`value` is `""`. A field with text keeps the arrows as before.
Contenteditable targets have no `value` and are unchanged.

One condition in `src/lib/shortcuts.ts`, plus tests, `docs/guide.md` and
a changelog line.

## Validation

- `scripts/ui-regression.ts`: new check after the switch to chat. From
the empty message box, Ctrl+Shift+↓ leaves the pane; with a draft, it
stays.
  - Without the fix: `Timed out: the empty message box leaves the pane`.
- With the fix: `PASS pane shortcut from the empty message box; a draft
keeps text selection`, and the full script passes.
- `src/lib/shortcuts.test.ts`: empty textarea and empty text input
switch panes; fields with text keep the arrows. The new expectations
fail without the fix.
- `bun run generate:types --check`, `bun run typecheck`, `bun run
build`, `bun run test:unit` (2720 pass, 0 fail).
- Not checked: a real Mac.
- Unrelated: one of three `ui-regression.ts` runs failed earlier, at the
palette check `a scroll under a resting pointer leaves the arrow's
selection alone` (line 308), with and without this change. The other
runs passed it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Hako <[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