Skip to content

Commit

Permalink
Fix scroll into view to not move entire terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmbake committed Nov 23, 2023
1 parent ec5fbe7 commit eb61b2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Terminal = ({name, prompt, height = "600px", colorMode, onInput, children,
onInput(currentLineInput);
setCursorPos(0);
setCurrentLineInput('');
scrollIntoViewRef?.current?.scrollIntoView({ behavior: "auto", block: "center" });
setTimeout(() => scrollIntoViewRef?.current?.scrollIntoView({ behavior: "auto", block: "nearest" }), 500);
} else if (["ArrowLeft", "ArrowRight", "ArrowDown", "ArrowUp", "Delete"].includes(event.key)) {
const inputElement = event.currentTarget;
let charsToRightOfCursor = "";
Expand Down

0 comments on commit eb61b2c

Please sign in to comment.