Skip to content

fix: reconnect terminal on non-modified key presses #9686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 18, 2023
Merged
Changes from 1 commit
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
Next Next commit
Listen to web terminal keydown on capture
Instead of bubbling.  I think maybe what happens here is that xterm is
capturing key presses and preventing the event from bubbling?  So
setting the listener on the capture phase instead works around this.
Probably would also work to dipsose the terminal.
  • Loading branch information
code-asher committed Sep 14, 2023
commit 78ec07ba52e827487d831895051b02202ec2c36b
4 changes: 2 additions & 2 deletions site/src/pages/TerminalPage/TerminalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,10 @@ const useReloading = (isDisconnected: boolean) => {
window.location.reload();
};

document.addEventListener("keydown", keyDownHandler);
document.addEventListener("keydown", keyDownHandler, true);

return () => {
document.removeEventListener("keydown", keyDownHandler);
document.removeEventListener("keydown", keyDownHandler, true);
};
}, [isDisconnected]);

Expand Down