Skip to content

Commit d2cc8c3

Browse files
committed
fix typing event bug
1 parent 4f4ad65 commit d2cc8c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ const Terminal = ({
110110
};
111111

112112
const handleInputKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
113-
event.preventDefault();
114113
if (!onInput) {
115114
return;
116115
}
117116
if (event.key === "Enter") {
117+
event.preventDefault();
118118
onInput(currentLineInput);
119119
setCursorPos(0);
120120

@@ -141,6 +141,7 @@ const Terminal = ({
141141
event.key,
142142
)
143143
) {
144+
event.preventDefault();
144145
const inputElement = event.currentTarget;
145146
let charsToRightOfCursor = "";
146147
let cursorIndex =

0 commit comments

Comments
 (0)