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(view-shell): keep split close available in navigation overlays (#8092)

dev-rbc42db096964a
diff --git a/apps/web/src/components/view-shell/README.md b/apps/web/src/components/view-shell/README.md
index d94259b6b1..a6565681d6 100644
--- a/apps/web/src/components/view-shell/README.md
+++ b/apps/web/src/components/view-shell/README.md
@@ -18,8 +18,9 @@ The control inset is derived from that center and the control's size. Never
align trailing controls by their outer edges or offset an individual icon.
- `ViewSidebar.Primary` gives create actions and toolbars the same 8px top inset.
-- `ViewSidebar.CloseButton` shows split close only in docked navigation, never
- inside a narrow navigation overlay. Keep split-close controls out of overlays.
+- `ViewSidebar.CloseButton` closes the owning split in both docked navigation and
+ narrow navigation overlays. Its visibility follows the split controller, not
+ the sidebar breakpoint; the last remaining list split still has no close action.
- `ViewSidebar.Toolbar` aligns its final `Control` with the right rail.
- `ViewSidebar.Content` owns outer gutters, 16px top/bottom padding, and section gaps.
- `Item` and `Action` own row spacing; use `Icon` for leading glyphs and
diff --git a/apps/web/src/components/view-shell/ViewShell.test.tsx b/apps/web/src/components/view-shell/ViewShell.test.tsx
index 9240b561c2..e09b37f96c 100644
--- a/apps/web/src/components/view-shell/ViewShell.test.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.test.tsx
@@ -2,6 +2,7 @@ import {
SplitPanelContext,
type SplitPanelContextType,
} from '@components/app/split-layout/context';
+import { SplitPanel } from '@components/app/split-panel';
import {
cleanup,
fireEvent,
@@ -30,6 +31,7 @@ vi.mock('@solid-primitives/resize-observer', () => ({
vi.mock('@ui', async () => ({
...(await import('../ui/utils/classname')),
+ ...(await import('../ui/utils/press')),
Button: (
props: JSX.ButtonHTMLAttributes<HTMLButtonElement> & { label?: string }
) => (
@@ -37,6 +39,7 @@ vi.mock('@ui', async () => ({
aria-label={props.label}
aria-expanded={props['aria-expanded']}
onClick={props.onClick}
+ onMouseDown={props.onMouseDown}
>
{props.children}
</button>
@@ -280,6 +283,7 @@ function Workspace(props: {
>
<ViewShell.Aside>
<ViewSidebar.Header>
+ <ViewSidebar.CloseButton />
<ViewSidebar.Title>{props.app}</ViewSidebar.Title>
</ViewSidebar.Header>
</ViewShell.Aside>
@@ -294,6 +298,52 @@ function Workspace(props: {
);
}
+it.each([720, 600, 400])(
+ 'keeps split close available in a %spx navigation overlay',
+ (width) => {
+ measurement.width = () => width;
+ const [canClose, setCanClose] = createSignal(true);
+ const panes = ['home', 'tasks', 'email'].map((app) => ({
+ app,
+ close: vi.fn(),
+ }));
+ render(() =>
+ panes.map((pane) => (
+ <SplitPanel.Root
+ controller={{
+ canClose,
+ close: pane.close,
+ canGoBack: () => false,
+ goBack: vi.fn(),
+ canGoForward: () => false,
+ goForward: vi.fn(),
+ }}
+ >
+ <Workspace app={pane.app} />
+ </SplitPanel.Root>
+ ))
+ );
+
+ for (const pane of panes) {
+ const workspace = within(screen.getByRole('region', { name: pane.app }));
+ fireEvent.click(
+ workspace.getByRole('button', { name: 'Show navigation' })
+ );
+ expect(workspace.getByRole('button', { name: 'Close' })).toBeTruthy();
+ }
+
+ const email = within(screen.getByRole('region', { name: 'email' }));
+ fireEvent.click(email.getByRole('button', { name: 'Close' }));
+ expect(panes[2].close).toHaveBeenCalledOnce();
+ expect(panes[0].close).not.toHaveBeenCalled();
+ expect(panes[1].close).not.toHaveBeenCalled();
+
+ setCanClose(false);
+ expect(email.queryByRole('button', { name: 'Close' })).toBeNull();
+ expect(email.getByRole('button', { name: 'Hide navigation' })).toBeTruthy();
+ }
+);
+
it('hides only the owning split and keeps the current item mounted', () => {
const mounted = vi.fn();
render(() => (
diff --git a/apps/web/src/components/view-shell/ViewShell.tsx b/apps/web/src/components/view-shell/ViewShell.tsx
index 972756bc29..03aa51ecab 100644
--- a/apps/web/src/components/view-shell/ViewShell.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.tsx
@@ -20,7 +20,6 @@ import { tourTarget } from '@ui/components/Tour';
import {
type Accessor,
batch,
- type ComponentProps,
createComputed,
createContext,
createSignal,
@@ -539,17 +538,8 @@ function Aside(props: ViewShellAsideProps) {
);
}
-/** A navigation overlay must not offer an action that closes its owning split. */
-export function ViewSidebarCloseButton(
- props: ComponentProps<typeof SplitPanel.CloseButton>
-) {
- const ws = useContext(ViewShellContext);
- return (
- <Show when={!ws?.atLayoutBreakpoint()}>
- <SplitPanel.CloseButton {...props} />
- </Show>
- );
-}
+/** Keep split close available in both docked and overlay navigation. */
+export const ViewSidebarCloseButton = SplitPanel.CloseButton;
/** Safe outside a shell so block preview headers can share this control. */
export function ViewSidebarToggle(props: { action: 'collapse' | 'expand' }) {
diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.md
index 858f79f2e9..856496add5 100644
--- a/docs/agent-guide/navigation.md
+++ b/docs/agent-guide/navigation.md
@@ -424,8 +424,11 @@ Home's inner rail starts with a full-width **New chat** plus button that returns
to Home's starting pane without creating a chat. Email and Tasks use the same
pill styling and top placement for **New email** and **New task**, replacing
the sidebar title bars. When multiple desktop splits are open, a **Close** (X)
-button appears beside each sidebar's New button and closes that split. The last
-logical split has no sidebar close button; mobile chrome is unchanged.
+button appears beside each sidebar's New button and closes that split, including
+when the sidebar is an overlay in a narrow split. Verify with three splits:
+open **Show navigation**, then use the sidebar's **Close** button without first
+hiding navigation; only its owning split closes. The last logical split has no
+sidebar close button; mobile chrome is unchanged.
A lone non-list content split still shows a header X labeled **Return to list**,
which returns that split to the most recent list in its history, preserving
that list’s state. If there is no prior list, it replaces the current entry with