1
0
Fork 0

fix(sidebar): ignore toggle shortcut while typing in inputs

Skip the Cmd/Ctrl+B sidebar toggle when the event originates from a
TEXTAREA, INPUT, or contentEditable element so editor shortcuts work.
This commit is contained in:
Jason Fraley 2026-09-06 05:32:04 -04:00
parent 49bffc04a5
commit fb83250ff5

View file

@ -98,6 +98,13 @@ const SidebarProvider = React.forwardRef<
// Adds a keyboard shortcut to toggle the sidebar.
React.useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
const target = event.target;
if (
target instanceof HTMLElement &&
(target.tagName === "TEXTAREA" || target.tagName === "INPUT" || target.isContentEditable)
) {
return;
}
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
event.preventDefault();
toggleSidebar();