From 9aee7c898f6ad5cf80d9e95e4ff153f656c75cea Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 12 Jun 2025 22:28:04 +0700 Subject: [PATCH] ensure no keyboard events leak through to the canvas --- frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx b/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx index 41a99237ab..4744380c32 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx @@ -235,11 +235,13 @@ export const PromptBox2D = ({ const handlePaste = (e: React.ClipboardEvent) => { e.preventDefault(); + e.stopPropagation(); const pastedText = e.clipboardData.getData("text").trim(); setPrompt(pastedText); }; const handleChange = (e: React.ChangeEvent) => { + e.stopPropagation(); setPrompt(e.target.value); }; @@ -444,9 +446,11 @@ export const PromptBox2D = ({ }; const handleKeyDown = (e: React.KeyboardEvent) => { + // Stop propagation of keyboard events to prevent them from reaching the canvas + e.stopPropagation(); + if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); - handleEnqueue(); } };