Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/renderer/components/layout/SessionSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export function SessionSidebar() {
// Cmd/Ctrl+N opens the New Session dialog when there's an active project.
// Suppressed while the user is typing into an input/textarea or another
// dialog already has focus, so it doesn't hijack normal text entry.
// xterm renders a hidden .xterm-helper-textarea to capture keystrokes —
// treat that as a terminal, not a real text input, so the shortcut works
// when an agent terminal has focus.
useEffect(() => {
const handler = (e: KeyboardEvent) => {
if (!(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey) return
Expand All @@ -72,8 +75,11 @@ export function SessionSidebar() {
const target = e.target as HTMLElement | null
if (target) {
const tag = target.tagName
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return
if (target.isContentEditable) return
const isXtermInput = target.classList.contains('xterm-helper-textarea') || !!target.closest('.xterm')
if (!isXtermInput) {
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return
if (target.isContentEditable) return
}
// Skip if focus is inside an open modal/dialog.
if (target.closest('[role="dialog"]')) return
}
Expand Down
Loading