Skip to content

feat: add terminal shortcuts panel for mobile#411

Merged
blackmammoth merged 4 commits intositeboon:mainfrom
PaloSP:feat/terminal-shortcuts-panel
Mar 4, 2026
Merged

feat: add terminal shortcuts panel for mobile#411
blackmammoth merged 4 commits intositeboon:mainfrom
PaloSP:feat/terminal-shortcuts-panel

Conversation

@PaloSP
Copy link
Contributor

@PaloSP PaloSP commented Feb 22, 2026

Summary

  • Adds a slide-out panel on the terminal view with quick-tap buttons for keys unavailable on mobile keyboards
  • Shortcuts: Escape, Tab, Shift+Tab, Arrow Up, Arrow Down, plus Scroll to Bottom
  • Styled to match the existing QuickSettingsPanel (same positioning, z-index, transitions, backdrop)
  • Mobile-optimized touch handling to prevent keyboard popup and stuck button states
  • Translations added for all 4 locales (en, ja, ko, zh-CN)

Test plan

  • Handle button opens/closes the panel, shortcuts send keys to terminal
  • Shortcut buttons close the panel after action, no stuck pressed states
  • Backdrop click/tap closes the panel
  • Works on both desktop and mobile (no keyboard popup on mobile)
image

Summary by CodeRabbit

  • New Features
    • Terminal Shortcuts Panel: collapsible right-side panel with a pull-tab showing keyboard and touch-accessible shortcuts (keys, navigation, scroll down). Activating a shortcut sends input to the terminal, panel respects connection state and avoids stealing focus. Localized strings added for English, Japanese, Korean, and Simplified Chinese.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e986074 and 09c791e.

📒 Files selected for processing (1)
  • src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx

📝 Walkthrough

Walkthrough

Adds localized terminalShortcuts entries for four locales, exposes terminalRef and wsRef from the shell runtime hook, and introduces a new collapsible TerminalShortcutsPanel component that sends shortcut input over WebSocket and interacts with the terminal instance.

Changes

Cohort / File(s) Summary
Localization
src/i18n/locales/en/settings.json, src/i18n/locales/ja/settings.json, src/i18n/locales/ko/settings.json, src/i18n/locales/zh-CN/settings.json
Added new top-level terminalShortcuts objects with localized strings (title, sections, key labels, navigation, and panel open/close labels).
Types & Hook
src/components/shell/types/types.ts, src/components/shell/hooks/useShellRuntime.ts
Added `terminalRef: MutableRefObject<Terminal
Shell Integration
src/components/shell/view/Shell.tsx
Imported and rendered TerminalShortcutsPanel, passing wsRef, terminalRef, and isConnected.
New UI Component
src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx
Added default-export React component implementing a collapsible side panel with shortcut list, sends shortcut input via WebSocket, invokes terminal scroll, manages focus/timeouts, and uses i18n keys. Review event handling and WebSocket message format.

Sequence Diagram

sequenceDiagram
    participant User
    participant Panel as TerminalShortcutsPanel
    participant WS as WebSocket
    participant Terminal as Terminal Instance

    User->>Panel: Open panel / select shortcut
    Panel->>Panel: validate isConnected and handle focus
    alt send input shortcut
        Panel->>WS: sendSocketMessage(shortcut payload)
        WS->>Terminal: deliver input
        Terminal-->>User: render output
        Panel->>Panel: start/clear auto-close timeout
    else navigation shortcut (scroll)
        Panel->>Terminal: terminal.scrollToBottom()
        Terminal-->>User: view scrolled
        Panel->>Panel: start/clear auto-close timeout
    end
Loading

Possibly related PRs

  • Feat:add i18n #303 — Related i18n work that introduced/extended the settings namespace used for terminal shortcuts.

Suggested reviewers

  • blackmammoth

Poem

🐰
In a shell of clicks and midnight hops,
Shortcuts peek out from panel props.
A socket hums, the terminal sings,
Keys flutter like tiny wings.
Tap — and magic scrolls and pops.

🚥 Pre-merge checks | ✅ 2 | ❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add terminal shortcuts panel for mobile' clearly and accurately summarizes the main change—adding a new terminal shortcuts panel component designed for mobile users.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@PaloSP PaloSP force-pushed the feat/terminal-shortcuts-panel branch from 2467736 to ec3f879 Compare February 22, 2026 15:52
@blackmammoth
Copy link
Collaborator

hey @PaloSP ! I like this PR. Can you resolve the merge conflict so that it can be reviewed?

@blackmammoth blackmammoth marked this pull request as draft February 26, 2026 11:29
Slide-out panel providing touch-friendly shortcut buttons (Esc, Tab,
Shift+Tab, Arrow Up/Down) and scroll-to-bottom for the terminal.
Integrates into the new modular shell architecture by exposing
terminalRef and wsRef from useShellRuntime hook and reusing the
existing sendSocketMessage utility.

Includes localization keys for en, ja, ko, and zh-CN.
@PaloSP PaloSP force-pushed the feat/terminal-shortcuts-panel branch from ec3f879 to 4472135 Compare March 1, 2026 18:16
@PaloSP
Copy link
Contributor Author

PaloSP commented Mar 1, 2026

Merge conflict resolved — rebased onto latest main and adapted to the new modular shell architecture.

Note: would appreciate if native speakers could verify the ja, ko, and zh-CN translations.

@blackmammoth blackmammoth marked this pull request as ready for review March 3, 2026 17:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx (1)

49-55: Clear any pending close timer before scheduling a new one.

This avoids stale timer overlap during rapid interactions.

♻️ Small safety improvement
 const handleShortcutAction = useCallback((action: () => void) => {
   action();
   if (document.activeElement instanceof HTMLElement) {
     document.activeElement.blur();
   }
+  if (closeTimeoutRef.current) {
+    clearTimeout(closeTimeoutRef.current);
+  }
   closeTimeoutRef.current = setTimeout(() => setIsOpen(false), 50);
 }, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx` around
lines 49 - 55, handleShortcutAction currently schedules a new close timeout
without clearing any existing timer, which can cause overlapping/stale timers;
before assigning closeTimeoutRef.current = setTimeout(...), call
clearTimeout(closeTimeoutRef.current) (and ensure closeTimeoutRef is the ref
holding the timeout id) so any pending timeout is canceled, then set the new
timeout and call setIsOpen(false) as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx`:
- Around line 90-91: The component currently attaches duplicate handlers
(onTouchEnd and onClick) that fire twice on touch devices; replace these pairs
with single pointer handlers (onPointerUp) and consolidated handler functions
that accept a PointerEvent. Create new handlers (e.g., handlePointerToggle to
replace handleToggleTouch/handleToggle, handlePointerShortcut to replace
handleShortcutTouch/handleShortcut, and similar for copy/other shortcut actions)
that call event.preventDefault(), optionally inspect event.pointerType if
needed, then invoke the existing toggle/send logic; update the JSX to use
onPointerUp={handlePointerX} and remove the onTouchEnd/onClick props at the
occurrences around the current handlers (the ones referenced as
handleToggleTouch/handleToggle and the shortcut handlers near lines 137–142,
164–165, 185–186).

---

Nitpick comments:
In `@src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx`:
- Around line 49-55: handleShortcutAction currently schedules a new close
timeout without clearing any existing timer, which can cause overlapping/stale
timers; before assigning closeTimeoutRef.current = setTimeout(...), call
clearTimeout(closeTimeoutRef.current) (and ensure closeTimeoutRef is the ref
holding the timeout id) so any pending timeout is canceled, then set the new
timeout and call setIsOpen(false) as before.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec3f879 and c4a5584.

📒 Files selected for processing (8)
  • src/components/shell/hooks/useShellRuntime.ts
  • src/components/shell/types/types.ts
  • src/components/shell/view/Shell.tsx
  • src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx
  • src/i18n/locales/en/settings.json
  • src/i18n/locales/ja/settings.json
  • src/i18n/locales/ko/settings.json
  • src/i18n/locales/zh-CN/settings.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/i18n/locales/ja/settings.json
  • src/i18n/locales/en/settings.json
  • src/i18n/locales/ko/settings.json

PaloSP added a commit to PaloSP/claudecodeui that referenced this pull request Mar 3, 2026
Prevents double-fire on touch devices by using onPointerUp instead of
separate onTouchEnd + onClick pairs. Also clears pending close timer
before scheduling a new one to avoid stale timeout overlap.

Addresses CodeRabbit review feedback on PR siteboon#411.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx`:
- Around line 60-74: The pointer-only handlers block keyboard activation;
restore keyboard support by adding equivalent click/keyboard handlers that
invoke the same actions: attach onClick (and/or onKeyDown handling Enter/Space)
to the same elements that currently use onPointerUp and call handleToggle or
handleShortcutAction respectively; update or reuse handlePointerToggle and
handlePointerShortcut logic by adding small wrappers (e.g., handleClickToggle ->
call handleToggle, handleClickShortcut -> call handleShortcutAction(action)) so
keyboard-generated clicks activate the buttons and keep existing pointer
handlers intact.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4a5584 and e986074.

📒 Files selected for processing (1)
  • src/components/shell/view/subcomponents/TerminalShortcutsPanel.tsx

Prevents double-fire on touch devices by removing onTouchEnd handlers
and using a single onClick for all interactions (mouse, touch, keyboard).
onPointerDown with preventDefault handles focus steal prevention.
Also clears pending close timer before scheduling a new one to avoid
stale timeout overlap.

Addresses CodeRabbit review feedback on PR siteboon#411.
@PaloSP PaloSP force-pushed the feat/terminal-shortcuts-panel branch from e986074 to 09c791e Compare March 3, 2026 17:52
@PaloSP
Copy link
Contributor Author

PaloSP commented Mar 3, 2026

@blackmammoth CodeRabbit feedback addressed — replaced dual touch/click handlers with unified pointer events and added timer cleanup. Ready for review.

Copy link
Collaborator

@blackmammoth blackmammoth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works well!

@blackmammoth blackmammoth merged commit b0a3fdf into siteboon:main Mar 4, 2026
1 check passed
SuperOuxx pushed a commit to SuperOuxx/coding-agent-ui that referenced this pull request Mar 5, 2026
* feat: add terminal shortcuts panel for mobile users

Slide-out panel providing touch-friendly shortcut buttons (Esc, Tab,
Shift+Tab, Arrow Up/Down) and scroll-to-bottom for the terminal.
Integrates into the new modular shell architecture by exposing
terminalRef and wsRef from useShellRuntime hook and reusing the
existing sendSocketMessage utility.

Includes localization keys for en, ja, ko, and zh-CN.

* fix: replace dual touch/click handlers with unified pointer events

Prevents double-fire on touch devices by removing onTouchEnd handlers
and using a single onClick for all interactions (mouse, touch, keyboard).
onPointerDown with preventDefault handles focus steal prevention.
Also clears pending close timer before scheduling a new one to avoid
stale timeout overlap.

Addresses CodeRabbit review feedback on PR siteboon#411.

---------

Co-authored-by: Haileyesus <118998054+blackmammoth@users.noreply.github.com>
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