ensure no keyboard events leak through to the canvas

This commit is contained in:
bflatastic committed 2025-06-12 22:28:04 +07:00
1 parent b046f6ff2a
commit 9aee7c898f
1 file changed
+5 -1
@@ -235,11 +235,13 @@ export const PromptBox2D = ({
const handlePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {
e.preventDefault();
e.stopPropagation();
const pastedText = e.clipboardData.getData("text").trim();
setPrompt(pastedText);
};
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
e.stopPropagation();
setPrompt(e.target.value);
};
@@ -444,9 +446,11 @@ export const PromptBox2D = ({
};
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
// Stop propagation of keyboard events to prevent them from reaching the canvas
e.stopPropagation();
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleEnqueue();
}
};