feat(web): auto-focus terminal on open (#876)

When the terminal page loaded, focus stayed on the page body — the user
had to click/tap into the xterm area before keystrokes were captured.
Add terminal.focus() at the end of handleTerminalMount so focus lands
inside the terminal as soon as the xterm instance is attached to the DOM.
The quick-input buttons already call terminalRef.current?.focus() after
each press; this extends the same pattern to the initial mount.

Closes #875

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
HeavyGee
2026-06-11 09:10:54 +08:00
committed by GitHub
co-authored by Cursor
parent 17439ae02c
commit e6b723f693
+1
View File
@@ -264,6 +264,7 @@ export default function TerminalPage() {
const modifierState = modifierStateRef.current
dispatchSequence(data, modifierState)
})
terminal.focus()
},
[dispatchSequence]
)