Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(sidebar): stop focus from getting trapped in sidebar (#3383)

Peter Chinman5850f5dceafd
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 3df241e840..5756477e6b 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -403,6 +403,10 @@ const SidebarActionButton = (props: SidebarActionButtonProps) => {
tooltipPlacement="right"
label={props.isSlim() ? props.label : undefined}
hotkey={props.isSlim() ? props.hotkeyToken : undefined}
+ onMouseDown={(e) => {
+ if (e.button !== 0) return;
+ e.preventDefault();
+ }}
onClick={(event: MouseEvent) => props.onClick(event)}
disabled={isDisabled()}
onMouseEnter={() => setHovering(true)}
@@ -556,7 +560,14 @@ export const AppSidebar = (props: AppSidebarProps) => {
<div class="grow shrink-10 min-w-0" />
<Button
class="flex items-center justify-center rounded-xs p-0.5 px-2 bg-surface [&_svg]:size-4"
- onClick={() => handleSidebarOpenChange(!isExpanded())}
+ onMouseDown={(e) => {
+ if (e.button !== 0) return;
+ e.preventDefault();
+ }}
+ onClick={() => {
+ handleSidebarOpenChange(!isExpanded());
+ globalSplitManager()?.returnFocus();
+ }}
onMouseEnter={() => setSidebarBtnHovering(true)}
onMouseLeave={() => setSidebarBtnHovering(false)}
label={isExpanded() ? 'Shrink Sidebar' : 'Expand Sidebar'}