Keep focus on the terminal after a channel switch (#35) #36
No reviewers
Labels
No labels
bug
docs
enhancement
good first issue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pedromcaraujo/forge!36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-palette-focus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #35.
Cause
Switching channels (palette or sidebar) left keyboard focus on
<body>, so the next keystroke went nowhere until you clicked the terminal.focusTerm()retried only over[0,60,200,500]ms, but a channel switch rebuilds xterm's textarea and reconnects ttyd's websocket — often not ready inside 500 ms — so every retry no-oped. The immediate call fromclosePalette()also runs while the iframe is still navigating, seeing only the outgoing document.Fix (
web/index.html,focusTerm()only)[0,60,150,300,500,800,1200,1800]ms so it outlasts a cold ttyd connect.focusGentoken so the still-navigatingclosePalette()call is superseded by the new page's load-time call instead of fighting it.Verification
Needs a browser (can't verify from CI): Alt+K → pick another channel → type immediately without clicking; keystrokes should reach the shell. Test both a warm session and a cold one (slower ttyd connect), and confirm clicking into the issues drawer right after a switch still keeps focus where you clicked.