From 0f3e7ec7e325f09a6d819e3867dd14dd2360f1df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Mon, 21 Oct 2024 08:38:28 +0100 Subject: [PATCH] chore: Unleash AI chat UX bug fixes (#8488) https://linear.app/unleash/issue/2-2859/small-ux-bug-fixes-on-the-unleash-ai-chat Bug fixes: - Up and down arrow keys not functioning in multiline input - Multiline input expanding beyond the intended size limit - Chat window failing to properly scroll to the bottom when opened --- frontend/src/component/ai/AIChat.tsx | 4 +++- frontend/src/component/ai/AIChatInput.tsx | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/component/ai/AIChat.tsx b/frontend/src/component/ai/AIChat.tsx index a6db132e00..bc411e19e2 100644 --- a/frontend/src/component/ai/AIChat.tsx +++ b/frontend/src/component/ai/AIChat.tsx @@ -107,7 +107,9 @@ export const AIChat = () => { }; useEffect(() => { - scrollToEnd(); + requestAnimationFrame(() => { + scrollToEnd(); + }); const intersectionObserver = new IntersectionObserver( ([entry]) => { diff --git a/frontend/src/component/ai/AIChatInput.tsx b/frontend/src/component/ai/AIChatInput.tsx index ba900c1664..a119fd8d51 100644 --- a/frontend/src/component/ai/AIChatInput.tsx +++ b/frontend/src/component/ai/AIChatInput.tsx @@ -81,10 +81,11 @@ export const AIChatInput = ({ placeholder='Type your message here' fullWidth multiline - maxRows={20} + maxRows={5} value={message} onChange={(e) => setMessage(e.target.value)} onKeyDown={(e) => { + e.stopPropagation(); if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); send();