From 8cedfd2883f8a024d8b0260d54fc7132fa725ab8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 3 Aug 2026 01:33:03 +0000 Subject: [PATCH] fix(web): guard e.key before toLowerCase in chat keydown handler When a keydown event fires with e.key === undefined (e.g. from synthetic events via browser extensions, accessibility tools, or IME compositions), calling e.key.toLowerCase() throws an unhandled TypeError. Add optional chaining so e.key?.toLowerCase() safely returns undefined when e.key is absent, causing the if-condition to evaluate to false and the handler to skip gracefully. Fixes Sentry issue CONSUMER-APP-19V. Co-authored-by: Dhravya Shah --- apps/web/components/chat/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/components/chat/index.tsx b/apps/web/components/chat/index.tsx index c78df7f7..787060a6 100644 --- a/apps/web/components/chat/index.tsx +++ b/apps/web/components/chat/index.tsx @@ -1229,7 +1229,7 @@ export function ChatSidebar({ activeElement?.closest('[contenteditable="true"]') if ( - e.key.toLowerCase() === "t" && + e.key?.toLowerCase() === "t" && !e.metaKey && !e.ctrlKey && !e.altKey &&