Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Assistant chat check keycode enter (#32898)

Joshen Lim9f9b2be26236
diff --git a/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx b/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx
index 3dfb9e828a6..8f37b777283 100644
--- a/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx
+++ b/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx
@@ -56,11 +56,9 @@ const AssistantChatFormComponent = React.forwardRef<HTMLFormElement, FormProps>(
const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
// Check if the pressed key is "Enter" (key code 13) without the "Shift" key
// also checks if the commands popover is open
- if (event.key === 'Enter' && !event.shiftKey && !commandsOpen) {
+ if (event.key === 'Enter' && event.keyCode === 13 && !event.shiftKey && !commandsOpen) {
event.preventDefault()
- if (submitRef.current) {
- submitRef.current.click()
- }
+ if (submitRef.current) submitRef.current.click()
}
// handles closing the commands popover if open
@@ -71,6 +69,7 @@ const AssistantChatFormComponent = React.forwardRef<HTMLFormElement, FormProps>(
return (
<form
+ id="assistant-chat"
ref={formRef}
{...props}
onSubmit={onSubmit}
@@ -119,7 +118,7 @@ const AssistantChatFormComponent = React.forwardRef<HTMLFormElement, FormProps>(
clipRule="evenodd"
d="M13.5 3V2.25H15V3V10C15 10.5523 14.5522 11 14 11H3.56062L5.53029 12.9697L6.06062 13.5L4.99996 14.5607L4.46963 14.0303L1.39641 10.9571C1.00588 10.5666 1.00588 9.93342 1.39641 9.54289L4.46963 6.46967L4.99996 5.93934L6.06062 7L5.53029 7.53033L3.56062 9.5H13.5V3Z"
fill="currentColor"
- ></path>
+ />
</svg>
</button>
</div>