diff --git a/apps/web/src/components/AppShell.tsx b/apps/web/src/components/AppShell.tsx index a005b12291..d87eb9524d 100644 --- a/apps/web/src/components/AppShell.tsx +++ b/apps/web/src/components/AppShell.tsx @@ -333,8 +333,14 @@ export function AppShell({ children }: AppShellProps) {
0 ? 'var(--sam-space-gutter)' : 0, + columnGap: 'var(--sam-shell-gap)', + // The frame, the gap between the nav and the content, and how far the content's + // left edge is from the nav or, in Zen, the screen edge. Full-bleed pages read these + // to reach the screen edge and the nav with their scrollers (`OverviewLayout`). + ['--sam-shell-frame' as string]: '16px', + ['--sam-shell-gap' as string]: navWidth > 0 ? 'var(--sam-space-gutter)' : '0px', + ['--sam-shell-inset-start' as string]: + navWidth > 0 ? 'var(--sam-space-gutter)' : 'var(--sam-shell-frame)', ['--sam-void-x' as string]: '58%', }} > diff --git a/apps/web/src/components/inbox/InboxRow.tsx b/apps/web/src/components/inbox/InboxRow.tsx index e98c757af7..a5e02d6698 100644 --- a/apps/web/src/components/inbox/InboxRow.tsx +++ b/apps/web/src/components/inbox/InboxRow.tsx @@ -115,15 +115,18 @@ export const InboxRow = memo(function InboxRow({ : first.ref === selectedRef; return (
  • + {/* The cards behind the first one. The front card is translucent, so each back card is + clipped to the 3px it shows below the card in front of it: unclipped, its outline and + fill showed through the front card. */} {stack && ( <>
  • + + + + + + + {item.title} + + + {IDEA_STATE_LABELS[item.derived.state]}. + {item.derived.state === 'working' && ( + <> + {' '} + + )} + {ideaRowLine(item)} + + + +
  • + ); +} + function MergedPullRequestRow({ pr }: { pr: OverviewMergedPullRequest }) { const mergedAt = pr.mergedAt ? Date.parse(pr.mergedAt) : Number.NaN; return ( @@ -322,11 +360,11 @@ export function RecentlySection({
    {ideas.length > 0 && ( -
    +
      {ideas.map((item) => ( - + ))} -
    + )} {pullRequests.length > 0 && (
      diff --git a/apps/web/tests/playwright/project-overview-audit.spec.ts b/apps/web/tests/playwright/project-overview-audit.spec.ts index 149acccde9..1af59e4ad3 100644 --- a/apps/web/tests/playwright/project-overview-audit.spec.ts +++ b/apps/web/tests/playwright/project-overview-audit.spec.ts @@ -985,3 +985,209 @@ test.describe('Project Overview as the landing page, with Needs you (slice F2)', await expect(page.getByTestId('overview-needs-you-list')).toBeVisible(); }); }); + +/** + * Every clipping box between a pane and the void: the pane must sit inside it with room for its + * shadow on both sides and below. Measured in page coordinates (rule 17), at the top of every + * scroller and again scrolled to the end, where the last pane's bottom shadow matters. + */ +async function expectPaneShadowsUnclipped(page: Page, room: number) { + const cuts = await page.evaluate((min) => { + const root = document.querySelector('[data-testid="project-overview"]'); + const found: string[] = []; + for (const pane of root?.querySelectorAll('section.sam-glass') ?? []) { + const box = pane.getBoundingClientRect(); + for ( + let node = pane.parentElement; + node && node !== document.body; + node = node.parentElement + ) { + const style = getComputedStyle(node); + if (style.display === 'contents') continue; + if (style.overflowX === 'visible' && style.overflowY === 'visible') continue; + const clip = node.getBoundingClientRect(); + // Edges a pane is scrolled past are not checked: only a pane in full view must clear them. + const inView = box.top >= clip.top && box.bottom <= clip.bottom; + const label = `${pane.getAttribute('aria-label')} in ${node.dataset.testid ?? node.tagName}`; + // The screen edge is the last clip: a pane may meet it like any other page edge. + if (node === document.documentElement) continue; + if (box.left - clip.left < min) found.push(`${label}: left ${box.left - clip.left}`); + if (clip.right - box.right < min) found.push(`${label}: right ${clip.right - box.right}`); + if (inView && clip.bottom - box.bottom < min) + found.push(`${label}: bottom ${clip.bottom - box.bottom}`); + } + } + return found; + }, room); + expect(cuts, 'a scroller cuts a pane shadow off at its edge').toEqual([]); +} + +async function scrollOverviewToEnd(page: Page) { + for (const id of ['overview-scroll', 'overview-main', 'overview-rail']) { + await page.getByTestId(id).evaluate((el) => { + el.scrollTop = el.scrollHeight; + }); + } + await page.waitForTimeout(200); +} + +test.describe('Project Overview layering and spacing', () => { + test('pane shadows are never cut off by a scroller', async ({ page }, testInfo) => { + await setupScene(page, { + scene: 'busy', + budget: 'stressed', + automations: 'failing', + inbox: STRESS_INBOX, + }); + await page.goto(BASE); + await expect(page.getByRole('region', { name: 'Recently' })).toBeAttached(); + await expect(page.getByRole('region', { name: 'Needs you' })).toBeVisible(); + // Room for the shadow: the phone frame is 10px, the desktop gutter 14px. + const room = isPhone(testInfo) ? 10 : 14; + await expectPaneShadowsUnclipped(page, room); + await scrollOverviewToEnd(page); + await expectPaneShadowsUnclipped(page, room); + // The bleed pads back what it takes: the first pane still starts a gap under the app bar + // (phone) or at the frame (desktop), and the task box stays pinned. + const first = await page.getByRole('region', { name: 'Needs you' }).boundingBox(); + if (isPhone(testInfo)) { + const appBar = await page.locator('header').first().boundingBox(); + await page.getByTestId('overview-scroll').evaluate((el) => { + el.scrollTop = 0; + }); + const top = await page.getByRole('region', { name: 'Needs you' }).boundingBox(); + expect(top!.y - (appBar!.y + appBar!.height)).toBeGreaterThanOrEqual(8); + expect(top!.x).toBeGreaterThanOrEqual(8); + // Panes leave at real edges: the scroller meets the app bar and the task box. + const scroller = await page.getByTestId('overview-scroll').boundingBox(); + const taskBox = await page + .locator('[data-testid="project-overview"] > div') + .last() + .boundingBox(); + expect(Math.abs(scroller!.y - (appBar!.y + appBar!.height))).toBeLessThanOrEqual(1); + expect(Math.abs(scroller!.y + scroller!.height - taskBox!.y)).toBeLessThanOrEqual(1); + } else { + expect(first!.y).toBeGreaterThanOrEqual(14); + // The two columns' boxes overlap in the gutter; the main column's scrollbar lives there, + // so the main column, not the rail, must own that strip. + const owner = await page.getByTestId('overview-main').evaluate((el) => { + const box = el.getBoundingClientRect(); + const hit = document.elementFromPoint(box.right - 3, box.top + box.height / 2); + return hit?.closest('[data-testid^="overview-"]')?.getAttribute('data-testid'); + }); + expect(owner).toBe('overview-main'); + } + await expectTaskBoxPinned(page); + await assertNoOverflow(page); + await page.screenshot({ + path: `../../.codex/tmp/playwright-screenshots/overview-layering-end-${page.viewportSize()?.width}.png`, + }); + }); + + for (const mode of ['focus', 'zen'] as const) { + test(`desktop ${mode} mode: pane shadows are not cut off either`, async ({ + page, + }, testInfo) => { + test.skip(isPhone(testInfo), 'focus modes are desktop-only'); + await page.addInitScript((value) => { + localStorage.setItem('sam:focus-mode', value); + }, mode); + await setupScene(page, { + scene: 'busy', + budget: 'stressed', + automations: 'failing', + inbox: STRESS_INBOX, + }); + await page.goto(BASE); + await expect(page.getByRole('region', { name: 'Needs you' })).toBeVisible(); + // Liveness: the mode really applied (Zen hides the nav; Focus narrows it). + const needs = await page.getByRole('region', { name: 'Needs you' }).boundingBox(); + expect(needs!.x).toBeLessThan(mode === 'zen' ? 40 : 120); + await expectPaneShadowsUnclipped(page, 14); + await scrollOverviewToEnd(page); + await expectPaneShadowsUnclipped(page, 14); + }); + } + + test('light theme: pane shadows are not cut off either', async ({ page }) => { + await page.addInitScript(() => { + localStorage.setItem('sam-theme', 'light'); + }); + await setupScene(page, { + scene: 'busy', + budget: 'stressed', + automations: 'failing', + inbox: STRESS_INBOX, + }); + await page.goto(BASE); + await expect + .poll(() => page.evaluate(() => document.documentElement.getAttribute('data-ui-theme'))) + .toBe('sam-light'); + await expect(page.getByRole('region', { name: 'Needs you' })).toBeVisible(); + await expectPaneShadowsUnclipped(page, 10); + await page.waitForTimeout(400); + await page.screenshot({ + path: `../../.codex/tmp/playwright-screenshots/overview-layering-light-top-${page.viewportSize()?.width}.png`, + }); + await scrollOverviewToEnd(page); + await expectPaneShadowsUnclipped(page, 10); + await page.screenshot({ + path: `../../.codex/tmp/playwright-screenshots/overview-layering-light-end-${page.viewportSize()?.width}.png`, + }); + }); + + test('a stacked Needs you row shows its back cards only below the front card', async ({ + page, + }) => { + await setupScene(page, { + scene: 'busy', + budget: 'stressed', + automations: 'failing', + inbox: STRESS_INBOX, + }); + await page.goto(BASE); + const stack = page.getByTestId('inbox-row').filter({ hasText: /3 from Ship billing/ }); + await expect(stack).toBeVisible(); + // Hit-testing honours clip-path: inside the front card, no back card may be under the point + // (it would show through the translucent card); below it, each back card is still there. + const result = await stack.evaluate((li) => { + const front = li.querySelector(':scope > div')!.getBoundingClientRect(); + const backs = [...li.querySelectorAll(':scope > span[aria-hidden="true"]')]; + const inside = backs.flatMap((back) => { + const box = back.getBoundingClientRect(); + const x = box.left + box.width / 2; + return [front.bottom - 2, front.bottom - 6].map((y) => + document.elementsFromPoint(x, y).includes(back) + ); + }); + const below = backs.map((back) => { + const box = back.getBoundingClientRect(); + return document.elementsFromPoint(box.left + box.width / 2, box.bottom - 1).includes(back); + }); + return { count: backs.length, inside, below }; + }); + expect(result.count).toBe(2); + expect(result.inside.every((hit) => !hit)).toBe(true); + expect(result.below).toEqual([true, true]); + }); + + test('Recently lines its ideas up with its pull requests', async ({ page }) => { + await setupScene(page, { scene: 'normal', budget: 'normal', automations: 'normal' }); + await page.goto(BASE); + const idea = page.getByTestId('overview-recent-idea').first(); + const pr = page.getByTestId('overview-merged-pr').first(); + await expect(idea).toContainText('Pause subscriptions'); + await expect(pr).toContainText('Round tax totals per line'); + const measure = (row: typeof idea) => + row.evaluate((el) => { + const icon = el.querySelector('svg')!.getBoundingClientRect(); + const title = el.querySelector(':scope > span:nth-of-type(2)')!.getBoundingClientRect(); + return { icon: icon.left, title: title.left, row: el.getBoundingClientRect().left }; + }); + const ideaBox = await measure(idea); + const prBox = await measure(pr); + expect(Math.abs(ideaBox.row - prBox.row)).toBeLessThanOrEqual(1); + expect(Math.abs(ideaBox.icon - prBox.icon)).toBeLessThanOrEqual(1); + expect(Math.abs(ideaBox.title - prBox.title)).toBeLessThanOrEqual(1); + }); +}); diff --git a/apps/web/tests/unit/AppShell.test.tsx b/apps/web/tests/unit/AppShell.test.tsx index 0032bf884e..a82c2d10a6 100644 --- a/apps/web/tests/unit/AppShell.test.tsx +++ b/apps/web/tests/unit/AppShell.test.tsx @@ -783,7 +783,7 @@ describe('AppShell (immersive chat view)', () => { 'composer', ]); expect(shellFrame()).not.toHaveAttribute('data-chat-immersive'); - expect(shellFrame()!.className).toContain('p-2.5'); + expect(shellFrame()!.style.getPropertyValue('--sam-shell-frame')).toBe('10px'); fireEvent.click(screen.getByRole('button', { name: 'Show only the conversation' })); // Pinned out of the flow and the shell switched in the same commit as the click. @@ -792,7 +792,7 @@ describe('AppShell (immersive chat view)', () => { expect(el.style.position).toBe('fixed'); } expect(shellFrame()).toHaveAttribute('data-chat-immersive', 'on'); - expect(shellFrame()!.className).toContain('p-1.5'); + expect(shellFrame()!.style.getPropertyValue('--sam-shell-frame')).toBe('6px'); await untilEntered(); expect(animations).toHaveLength(4); @@ -816,7 +816,7 @@ describe('AppShell (immersive chat view)', () => { expect(el.style.visibility).toBe(''); } expect(shellFrame()).not.toHaveAttribute('data-chat-immersive'); - expect(shellFrame()!.className).toContain('p-2.5'); + expect(shellFrame()!.style.getPropertyValue('--sam-shell-frame')).toBe('10px'); // A piece's own inline values survive the round trip, React-managed or not. expect(document.querySelector('aside')!.style.width).toBe('46px'); expect( diff --git a/docs/guides/sam-glass-design-system.md b/docs/guides/sam-glass-design-system.md index cc167dab35..25dec44c0c 100644 --- a/docs/guides/sam-glass-design-system.md +++ b/docs/guides/sam-glass-design-system.md @@ -78,7 +78,7 @@ Build these in `packages/ui/src/components/` with Tailwind and the tokens above, ## Screens -**Desktop chat (A1).** Four panes over the void: sidebar, chat list, conversation column, tool rail. The conversation column is three panes: a slab for the session info, the message history, and a slab for the message box. Routed pages that are not chat surfaces sit in one content pane the shell provides (`isFullBleedRoute()` in `apps/web/src/lib/shell-routes.ts` lists the chat surfaces, which lay out their own panes). That pane is the page's surface: a page paints no background of its own (`PageLayout` fills the pane without one), or the frost stops where its background box ends. On the chat surfaces the shell's `
      ` does not clip, so each pane's shadow falls into the gutters and the frame; the panes scroll inside themselves. +**Desktop chat (A1).** Four panes over the void: sidebar, chat list, conversation column, tool rail. The conversation column is three panes: a slab for the session info, the message history, and a slab for the message box. Routed pages that are not chat surfaces sit in one content pane the shell provides (`isFullBleedRoute()` in `apps/web/src/lib/shell-routes.ts` lists the chat surfaces, which lay out their own panes). That pane is the page's surface: a page paints no background of its own (`PageLayout` fills the pane without one), or the frost stops where its background box ends. On the chat surfaces the shell's `
      ` does not clip, so each pane's shadow falls into the gutters and the frame; the panes scroll inside themselves. A full-bleed page whose panes stack in a column that must scroll as a whole (the project Overview) cannot do that, so its scroller's box reaches out to what is next to it (the screen edge, the app bar or nav, the task box, the other column) and pads back the same distance, reading the shell's `--sam-shell-frame`, `--sam-shell-gap` and `--sam-shell-inset-start` (`OverviewLayout` in `apps/web/src/pages/project-overview/index.tsx`): the panes stay put, their shadows fall inside the scroller, and a pane scrolled away leaves at a real edge. **Chat list.** Each row: status icon (spinning green when working, moon when idle, amber when it needs you), one-line title, "shared with" avatars and a pull request badge on the right, then a meta line with the owner's 14px avatar and name ("You" for yours) and the age in mono. Rows someone else started get a thin light on the left edge in the owner's colour, so your own rows are the plain ones. Above the list: a segmented control (Mine / Others / All, with counts) and, beside it, small teammate avatars that filter to one person's sessions. diff --git a/tasks/archive/2026-11-16-overview-layering-spacing-shadows.md b/tasks/archive/2026-11-16-overview-layering-spacing-shadows.md new file mode 100644 index 0000000000..0d2b9e3c15 --- /dev/null +++ b/tasks/archive/2026-11-16-overview-layering-spacing-shadows.md @@ -0,0 +1,60 @@ +# Project Overview: clipped shadows, layering and spacing + +SAM task 01M7JPQYXA9P0SGVE5ZMTHPGZ5 (replaces 01M7J8G33ZT1AJ4TQJZ7G0F571). Owner asked to skip +staging and ship straight to production once CI, the reviewers and the Playwright audit pass. + +## Problem + +Raphaël, 2026-11-16 13:24Z, with a screenshot of the Project Overview (`/projects/:id/overview`): +"some of the layering/spacing is a bit wacky. Shadows being clipped. Elements not overlapping +properly." The screenshot is not available; the defects below were found by capturing the page +locally (375x667 and 1280x800, dark SAM Glass, busy-project mocks, top and scrolled) on the F2 +layout (PR #2793) that is about to be in production. + +## Findings (each with its cause) + +1. **Pane shadows cut off in hard rectangles.** Phone: `overview-scroll` is `overflow-y-auto` + and exactly as wide as the panes, so every pane's shadow stops at the pane's own left/right + edge and at the scroller's bottom. Desktop: `overview-main` and `overview-rail` are each + `overflow-y-auto` with the same problem. Rule 80 #3: nothing between a pane and the void may + clip. The existing audit's full-page capture forced `overflow: visible` on every ancestor, so + it could never show this. +2. **Panes sliced in mid-air when scrolled.** The same scrollers end a gap short of their + neighbours, so a pane scrolled away is cut along an invisible line 10px under the phone app + bar, 16px under the top of the screen on desktop, and 14px above the task box (worst with the + task box's options panel open: the Needs you pane is severed, leaving a stub of its border). +3. **Stacked inbox row shows its back cards through the front card.** `InboxRow` (shared with + the Inbox pages) draws two translucent back cards that sit partly behind the translucent + front card, so their outlines show through it. +4. **Recently mixes two row shapes.** Ideas used the Ideas page's full-width `IdeaRow` (px-4, + dividers, bold, chevron, 32px tinted icon) next to the Overview's own rows (px-2, 18px + icon, no dividers): different icon column and text edge in one pane. + +Looked at and left alone: the composer options panel's Effort select (reviewer suspected a clip; measured 128px in a 128px track, 13px inside its panel), gaps between panes (14px everywhere, consistent), profile picker and +options popovers (correct stacking), Budgets / This week / Automations content. + +## Checklist + +- [x] AppShell exposes its frame and gap as `--sam-shell-frame` / `--sam-shell-gap` +- [x] OverviewLayout scrollers bleed into their surroundings and pad back (phone + desktop) +- [x] InboxRow back cards clipped to the strip below the front card +- [x] Recently idea rows use the Overview row shape; `IdeaRow`'s now-unused `compact` removed +- [x] Playwright: pane shadows unclipped (measured, top and scrolled to end, both viewports) +- [x] Playwright: Recently idea and PR rows share icon column and text edge +- [x] Both checks proven red on the pre-fix code +- [x] Inbox page and Ideas page re-checked (inbox, ideas-list, ideas-ui, focus-mode, chat-immersive, sam-glass-chat audits: 225 passed) +- [x] Light theme checked (Playwright case + screenshots) +- [x] Review fix: Zen mode inset (`--sam-shell-inset-start`) + Focus/Zen Playwright cases (Zen red without the fix) +- [x] Review fix: main column above the rail (`md:z-10`) so its gutter scrollbar is reachable (hit-test assertion red without it) +- [x] Review fix (validator MEDIUM): stacked-row hit-test check (red without the clip-path) and a direct phone edge assertion (scroller meets app bar and task box) +- [x] Before/after screenshots posted on the PR (#2816 comment 6924823820) +- [x] ui-ux-specialist (ADDRESSED) and task-completion-validator (WARN, MEDIUM addressed) reviews +- [ ] CI green, merged, production deploy watched + +## Acceptance criteria + +- No pane shadow is cut by a scroller at 375x667 or 1280x800, at the top or end of scroll. +- A pane scrolled out of view disappears at the app bar / task box / screen edge. +- The stacked row shows no outlines through its front card. +- Recently's rows share one icon column and text edge. +- No behaviour change; F2's and the existing Overview audits stay green.