Skip to content

Commit

Permalink
fix(terminal-focus) auto-focus for terminal and text console
Browse files Browse the repository at this point in the history
  • Loading branch information
lorumic authored and edlerd committed May 9, 2023
1 parent 1adf9ad commit 7344b47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pages/instances/InstanceTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ const InstanceTerminal: FC<Props> = ({ instance }) => {
return [data, control];
};

useEffect(() => {
xtermRef.current?.terminal.focus();
}, [xtermRef.current, controlWs]);

useEffect(() => {
xtermRef.current?.terminal.clear();
setInTabNotification(null);
Expand Down
6 changes: 6 additions & 0 deletions src/pages/instances/InstanceTextConsole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ const InstanceTextConsole: FC<Props> = ({
return [data, control];
};

useEffect(() => {
if (isRunning) {
xtermRef.current?.terminal.focus();
}
}, [isRunning, xtermRef.current]);

useEffect(() => {
if (dataWs) {
return;
Expand Down

0 comments on commit 7344b47

Please sign in to comment.