From a3ea23ebd7da7a6a6f95343fcd1cad0effd8e2e3 Mon Sep 17 00:00:00 2001 From: YasinOnm08 Date: Thu, 19 Sep 2024 16:52:16 +0200 Subject: [PATCH] Enter works again --- app/InputFrontend.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/InputFrontend.tsx b/app/InputFrontend.tsx index c3cdea8..cf9dffc 100644 --- a/app/InputFrontend.tsx +++ b/app/InputFrontend.tsx @@ -14,19 +14,28 @@ const InputFrontend = React.forwardRef( setInputValue(e.target.value); }; + const handleKeyDown = (event: React.KeyboardEvent) => { + if (event.key === 'Enter') { + onSendClick(inputValue); // Call the function passed via props + setInputValue(''); // Optionally clear input after submission + event.preventDefault(); // Prevent default action (e.g., form submission) + } + }; + return ( -
+
- -