Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(kanban): improve card surface contrast (#9828)
dev-rb81dedbaa44bb
diff --git a/.agents/rules/web/ui.md b/.agents/rules/web/ui.mdindex 6f26fb23b6..5bf9535b7f 100644--- a/.agents/rules/web/ui.md+++ b/.agents/rules/web/ui.md@@ -22,6 +22,7 @@ Components, styling, and interaction conventions.default palette is disabled via `--color-*: initial` in`apps/web/src/index.css`, so classes like `text-red-500` silently rendernothing. Enforced by ast-grep `tsx-no-raw-tailwind-palette`, CI error.+ Use existing semantic surface tokens instead of component-local color mixes.- Keep runtime theme tokens together in `apps/web/src/index.css`: one`:root, [data-theme-light]` block for dark defaults, followed by one`[data-theme-light='true']` override block. Keep any narrower root/devicediff --git a/apps/web/src/components/drag-drop/drag-preview.test.ts b/apps/web/src/components/drag-drop/drag-preview.test.tsnew file mode 100644index 0000000000..c194b6a939--- /dev/null+++ b/apps/web/src/components/drag-drop/drag-preview.test.ts@@ -0,0 +1,59 @@+import { afterEach, describe, expect, it } from 'vitest';+import { cloneDragPreview } from './drag-preview';++afterEach(() => {+ document.body.replaceChildren();+});++describe('drag preview surfaces', () => {+ it('keeps the source background when moved over a different surface', () => {+ document.body.innerHTML = `+ <style>+ [data-source] article { background-color: rgb(32, 34, 38); }+ [data-overlay] article { background-color: rgb(240, 242, 246); }+ </style>+ <section data-source><article style="opacity: 0.35">Card</article></section>+ <section data-overlay></section>+ `;+ const card = document.querySelector('article')!;+ const overlay = document.querySelector('[data-overlay]')!;+ const background = getComputedStyle(card).backgroundColor;+ const preview = cloneDragPreview(card, 'data-preview');++ overlay.append(preview);++ expect(getComputedStyle(preview).backgroundColor).toBe(background);+ expect(getComputedStyle(preview).opacity).toBe('1');+ expect(getComputedStyle(card).opacity).toBe('0.35');+ });++ it('keeps source surface tokens for cards inside a dragged lane', () => {+ document.body.innerHTML = `+ <style>+ [data-source] section {+ --color-surface: rgb(32, 34, 38);+ --color-inset: rgb(24, 26, 30);+ }+ [data-overlay] section {+ --color-surface: rgb(240, 242, 246);+ --color-inset: rgb(232, 234, 238);+ }+ </style>+ <div data-source><section><article>Card</article></section></div>+ <div data-overlay></div>+ `;+ const lane = document.querySelector('section')!;+ const overlay = document.querySelector('[data-overlay]')!;+ const source = getComputedStyle(lane);+ const preview = cloneDragPreview(lane, 'data-preview');++ overlay.append(preview);++ expect(getComputedStyle(preview).getPropertyValue('--color-surface')).toBe(+ source.getPropertyValue('--color-surface')+ );+ expect(getComputedStyle(preview).getPropertyValue('--color-inset')).toBe(+ source.getPropertyValue('--color-inset')+ );+ });+});diff --git a/apps/web/src/components/drag-drop/drag-preview.ts b/apps/web/src/components/drag-drop/drag-preview.tsindex aee3d3e1f9..d47ae36246 100644--- a/apps/web/src/components/drag-drop/drag-preview.ts+++ b/apps/web/src/components/drag-drop/drag-preview.ts@@ -1,6 +1,7 @@/** A snapshot of `node` at its exact size, inert and hidden from assistive technology. */export function cloneDragPreview(node: HTMLElement, marker: string) {const bounds = node.getBoundingClientRect();+ const sourceStyle = getComputedStyle(node);const copy = node.cloneNode(true);if (!(copy instanceof HTMLElement))throw new Error('A drag preview clones an HTML element');@@ -14,6 +15,11 @@ export function cloneDragPreview(node: HTMLElement, marker: string) {copy.style.opacity = '1';copy.style.transform = 'none';copy.style.boxSizing = 'border-box';+ // The overlay does not inherit the source's Layer or surface overrides.+ copy.style.backgroundColor = sourceStyle.backgroundColor;+ for (const token of ['--color-surface', '--color-inset']) {+ copy.style.setProperty(token, sourceStyle.getPropertyValue(token));+ }copy.inert = true;copy.setAttribute('aria-hidden', 'true');copy.setAttribute(marker, '');diff --git a/apps/web/src/components/kanban/kanban.tsx b/apps/web/src/components/kanban/kanban.tsxindex fb144c3400..38186da321 100644--- a/apps/web/src/components/kanban/kanban.tsx+++ b/apps/web/src/components/kanban/kanban.tsx@@ -6,7 +6,7 @@ import {DragDropProvider,DragOverlay,} from '@thisbeyond/solid-dnd';-import { cn } from '@ui';+import { cn, Layer } from '@ui';import {createContext,createSignal,@@ -257,7 +257,7 @@ export function Kanban(props: KanbanProps) {},}}>- {props.children}+ <Layer offset={1}>{props.children}</Layer></DragContext.Provider><DragOverlayclass="pointer-events-none select-none"@@ -427,7 +427,7 @@ export function KanbanLane(props: {droppable.ref(node);}}class={cn(- 'relative flex w-72 shrink-0 flex-col rounded-xl border border-edge-frame bg-[color-mix(in_oklch,var(--color-panel)_94%,var(--color-ink))] p-2 transition-colors',+ 'relative flex w-72 shrink-0 flex-col rounded-xl border border-edge-frame bg-inset p-2 transition-colors',draggable.isActiveDraggable && 'opacity-35',highlighted() && 'ring-2 ring-accent',props.class@@ -497,7 +497,7 @@ export function KanbanCard(props: {<articleref={draggable.ref}class={cn(- 'group relative rounded-lg border border-edge-muted bg-surface-3 shadow-sm transition-shadow hover:border-edge hover:shadow-md',+ 'group relative rounded-lg border border-transparent bg-surface shadow-sm transition-shadow light-mode:border-edge-frame light-mode:shadow-md not-touch:hover:shadow-md',draggable.isActiveDraggable && 'opacity-35',props.pending && 'ring-1 ring-ink/20')}diff --git a/docs/agent-guide/ui-conventions.md b/docs/agent-guide/ui-conventions.mdindex 29963678ae..b2cca922c2 100644--- a/docs/agent-guide/ui-conventions.md+++ b/docs/agent-guide/ui-conventions.md@@ -76,6 +76,12 @@ draw a full 1px frame edge, menus keep the glass cast shadow, and`ComposerSurface` (composers and settings cards) keeps the wide `composer-shadow`halo. Touch surfaces retain their existing shadows.+Kanban boards advance one relative `Layer`: lanes use `bg-inset` and cards use+`bg-surface`. Light themes add a subtle `border-edge-frame` and medium shadow;+dark themes keep transparent card borders and the small resting shadow. Drag+previews retain the source's resolved background and surface tokens so cards and+whole lanes keep their appearance outside the board's layer context.+Desktop view tabs share one flat rounded track, with a small inset and a fullyrounded selected pill. Use borders and selected fills without raised edges,gradients, or shadows. Buttons use variant-specific pressed fills. Wrapping