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 <dhravya@supermemory.com>
This commit is contained in:
Cursor Agent 2026-08-03 01:33:03 +00:00
parent a787041ca7
commit 8cedfd2883
No known key found for this signature in database

View file

@ -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 &&