only focus main editor on mode toggle if another editor doesn't already have focus

This commit is contained in:
Dallin Romney 2025-07-01 12:20:59 -07:00
parent c86e88ff0c
commit 855b85585f

View file

@ -34,7 +34,10 @@ export function ModeSelect() {
const cycleMode = useCallback(() => {
dispatch(setMode(mode === "chat" ? "agent" : "chat"));
mainEditor?.commands.focus();
// Only focus main editor if another one doesn't already have focus
if (!document.activeElement?.classList?.contains("ProseMirror")) {
mainEditor?.commands.focus();
}
}, [mode, mainEditor]);
const selectMode = useCallback(