From c640d8053974f32bf16aa69fb526ccdc7cd699f7 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Mon, 14 Sep 2026 00:58:37 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9F=20fix:=20Opaque=20Header=20Control?= =?UTF-8?q?s=20Over=20the=20Chat=20Gradient=20(#15894)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ๐ŸชŸ fix: Opaque Header Controls Over the Chat Gradient The mobile sidebar toggle let the conversation show through itself: the chat header is a gradient fading to transparent with messages scrolling under it, and the shared `header-action` variant carried `bg-transparent` while every other control in that row sits on `bg-presentation`. * ๐Ÿ”’ fix: Keep an Explicit Button Shape Over the Header Compound A compound variant is emitted after the `shape` recipe, so the `header-action` + `size: 'sm'` corner repair outranked a caller that asked for `shape="theme"` or `shape="round"` โ€” `cn` kept the later `rounded-xl` and dropped the requested radius. Gate it on `shape: 'unset'`, the way the `subtle` compound already is, so it only repairs the default geometry. Adds the mobile header row's acceptance scenarios to the mock harness: the toggle's interior does not change as the conversation scrolls under it, its fill and corner match the new-chat and overflow controls beside it, and the drawer's close toggle is the same control by fill, corner and tap target. All three fail against the previous transparent fill. * ๐Ÿงช test: Rewind the Header Scenario Before Scrolling It The scroll scenario sampled the toggle from wherever a freshly opened conversation happened to land. That is the app's business โ€” the newest message with auto-scroll on, the top of a seeded transcript without it โ€” and a landed end leaves a wheel delta in that direction nothing to move, which would fail the "the conversation did not move" guard rather than measure the fill. Rewind to the top first, then bring the transcript down under the header, so the wheel always has a known distance to travel. The guard stays: a run where the conversation does not move still fails instead of passing vacuously. * ๐Ÿงช test: Read the Header Toggles With the Pointer Off Them `click()` leaves the pointer on the opener's coordinates, and the drawer slides its own toggle onto those same coordinates, so one of the pair could be reading `hover:bg-surface-active-alt` while the other sat on `bg-presentation` โ€” an equality that depended on when the 300ms slide settled. Move the pointer off both controls, wait for the drawer, and assert the pointer really is clear: each surface now reports its own `:hover` state, so a run that measures a hovered control fails on that rather than on the colour. --- .../components/Chat/SubagentThreadLink.tsx | 6 +- .../scenarios/header-control-surface.spec.ts | 265 ++++++++++++++++++ .../client/src/components/Button.spec.tsx | 32 ++- packages/client/src/components/Button.tsx | 19 +- 4 files changed, 317 insertions(+), 5 deletions(-) create mode 100644 e2e/specs/mock/scenarios/header-control-surface.spec.ts diff --git a/client/src/components/Chat/SubagentThreadLink.tsx b/client/src/components/Chat/SubagentThreadLink.tsx index 74cb097147..3833aba568 100644 --- a/client/src/components/Chat/SubagentThreadLink.tsx +++ b/client/src/components/Chat/SubagentThreadLink.tsx @@ -29,7 +29,11 @@ export default function SubagentThreadLink({ return ( ); - /** Transparent so the toggle reads as an icon on the header rather than a - * raised control; the border and hover still mark it as hit-able. */ + /** Opaque: the chat header is a gradient that fades to nothing with the + * conversation scrolling under it, so a transparent toggle shows message + * text through itself while every neighbour sits on `bg-presentation`. */ expect(screen.getByRole('button', { name: 'Toggle' })).toHaveClass( - 'bg-transparent', + 'bg-presentation', 'border-border-light', 'rounded-xl', 'duration-0', @@ -46,6 +47,31 @@ describe('Button', () => { ); }); + /** `size: 'sm'` carries `rounded-lg`, which is emitted after the variant and + * would otherwise win the merge, squaring off a text-bearing header control + * next to the icon-sized ones sharing its row. A caller that names a shape + * still outranks that repair, the way it does for `subtle`. */ + it('keeps the header-action corner at every size', () => { + const { rerender } = render( + , + ); + + const button = screen.getByRole('button', { name: 'Back' }); + expect(button).toHaveClass('rounded-xl', 'h-9', 'bg-presentation'); + expect(button).not.toHaveClass('rounded-lg'); + + rerender( + , + ); + + expect(button).toHaveClass('rounded-theme-control', 'h-9'); + expect(button).not.toHaveClass('rounded-xl'); + }); + it('preserves variant geometry until a shape is explicitly selected', () => { const { rerender } = render(); const button = screen.getByRole('button', { name: 'Subtle' }); diff --git a/packages/client/src/components/Button.tsx b/packages/client/src/components/Button.tsx index 72da84ee8f..4e562e233c 100644 --- a/packages/client/src/components/Button.tsx +++ b/packages/client/src/components/Button.tsx @@ -94,12 +94,17 @@ const buttonVariantRecipe = cva( * A control floating on the presentation surface โ€” the sidebar * toggle in the chat header and its mirror in the mobile drawer * header, so the pair reads as one persistent button across views. + * The fill is opaque and not transparent: the chat header is a + * gradient that fades to nothing while the conversation scrolls + * underneath, so a see-through control has message text moving + * through it, and every neighbour in that row โ€” model selector, new + * chat, overflow menu โ€” already sits on `bg-presentation`. * `duration-0` makes the hover fill instant: these sit over a * scrolling gradient, where the shared color transition reads as * lag rather than polish. */ 'header-action': - 'rounded-xl border border-border-light bg-transparent text-text-primary duration-0 hover:bg-surface-active-alt hover:text-text-primary', + 'rounded-xl border border-border-light bg-presentation text-text-primary duration-0 hover:bg-surface-active-alt hover:text-text-primary', }, size: { default: 'h-10 px-4 py-2', @@ -138,6 +143,18 @@ const buttonVariantRecipe = cva( size: 'default', class: 'h-auto px-1 py-2', }, + /* `size: 'sm'` brings its own `rounded-lg`, emitted after the variant + * and so winning the merge. A text-bearing header control keeps the + * row's `rounded-xl` corner, matching the icon-sized ones beside it. + * Gated on `shape: 'unset'` like `subtle` above: a compound is emitted + * after the shape recipe, so an ungated one would silently outrank a + * caller that asked for `shape="theme"` or `shape="round"`. */ + { + variant: 'header-action', + size: 'sm', + shape: 'unset', + class: 'rounded-xl', + }, ], defaultVariants: { variant: 'default',