Skip to content

Commit b727408

Browse files
authored
fix(web): keep the composer chin below the input (#21345)
1 parent 8cd9641 commit b727408

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import "~/index.css";
2+
3+
import { act } from "react";
4+
import { createRoot } from "react-dom/client";
5+
import { expect, it, vi } from "vite-plus/test";
6+
7+
import { ComposerSurface } from "./ComposerSurface";
8+
9+
it("masks the toolbar overlap and reveals its surface one pixel before the input edge", async () => {
10+
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
11+
const container = document.createElement("div");
12+
document.body.append(container);
13+
const root = createRoot(container);
14+
15+
try {
16+
await act(async () => {
17+
root.render(
18+
<ComposerSurface.Shell contextStrip>
19+
<ComposerSurface.Host>Message</ComposerSurface.Host>
20+
<ComposerSurface.ContextStrip>Workspace</ComposerSurface.ContextStrip>
21+
</ComposerSurface.Shell>,
22+
);
23+
});
24+
25+
const strip = container.querySelector('[data-slot="composer-context-strip"]')!;
26+
const mask = getComputedStyle(strip, "::before").maskImage;
27+
expect(mask).toContain("rgba(0, 0, 0, 0) 15px, rgb(0, 0, 0) 15px");
28+
} finally {
29+
await act(async () => root.unmount());
30+
container.remove();
31+
vi.unstubAllGlobals();
32+
}
33+
});

‎apps/web/src/components/chat/ComposerSurface.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ function Main({ className, ...props }: ComponentProps<"div">) {
7979
);
8080
}
8181

82-
/** Extends the composer outline below the input, masking its overlap up to one pixel above the shared edge so no seam shows. */
82+
/** Mask offsets use the position hint so class merging preserves the transparent and black stops. */
8383
function ContextStrip({ className, ...props }: ComponentProps<"div">) {
8484
return (
8585
<div
8686
data-slot="composer-context-strip"
8787
className={cn(
8888
"group/composer-context relative isolate mx-auto -mt-4 flex w-[calc(100%-2*var(--chat-composer-drawer-inset))] items-center gap-2 overflow-x-clip overflow-y-visible px-2 pt-5 pb-1",
89-
"before:absolute before:inset-0 before:-z-1 before:rounded-b-2xl before:border before:border-(--chat-composer-outline) before:mask-b-from-transparent before:mask-b-from-(length:--spacing-composer-seam) before:mask-b-to-black before:mask-b-to-(length:--spacing-composer-seam) before:shadow-composer",
89+
"before:absolute before:inset-0 before:-z-1 before:rounded-b-2xl before:border before:border-(--chat-composer-outline) before:mask-b-from-transparent before:mask-b-from-(position:--spacing-composer-seam) before:mask-b-to-black before:mask-b-to-(position:--spacing-composer-seam) before:shadow-composer",
9090
"dark:before:border-white/7 dark:before:bg-composer-seam-below dark:before:shadow-composer-dark",
9191
"group-has-data-[composer-banner-surface=attached]/composer-surface:before:bg-(--chat-composer-glass-surface)/(--glass-opacity) group-has-data-[composer-banner-surface=attached]/composer-surface:before:backdrop-blur-(--glass-blur) group-has-data-[composer-banner-surface=attached]/composer-surface:before:backdrop-saturate-(--glass-saturation)",
9292
"not-supports-[clip-path:shape(from_0_0,line_to_1px_1px)]:before:bg-(--chat-composer-glass-surface)/(--glass-opacity) not-supports-[clip-path:shape(from_0_0,line_to_1px_1px)]:before:backdrop-blur-(--glass-blur) not-supports-[clip-path:shape(from_0_0,line_to_1px_1px)]:before:backdrop-saturate-(--glass-saturation)",

0 commit comments

Comments
 (0)