From f7ae4c8e109f3e9516a361a503060c3ece19ca84 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Thu, 19 Nov 2026 22:55:48 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=AB=EF=B8=8F=20fix:=20Keep=20the=20Que?= =?UTF-8?q?stion=20Card's=20Bottom=20Edge=20Free=20of=20an=20Inner=20Shado?= =?UTF-8?q?w=20(#18538)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Keep the Question Card's Bottom Edge Free of an Inner Shadow * test: Assert the Question Card Leaves No Shadow Band Above the Composer --- .../scenarios/ask-question-refine.spec.ts | 45 +++++++++++++++++++ .../src/components/composer/ask/Popover.tsx | 4 +- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/e2e/specs/mock/scenarios/ask-question-refine.spec.ts b/e2e/specs/mock/scenarios/ask-question-refine.spec.ts index 2fcd93f480..5bdac4505c 100644 --- a/e2e/specs/mock/scenarios/ask-question-refine.spec.ts +++ b/e2e/specs/mock/scenarios/ask-question-refine.spec.ts @@ -128,6 +128,18 @@ const answerField = (scope: Scope, question: string) => const optionRow = (scope: Scope, name: string) => scope.getByRole('button', { name: new RegExp(`${escapeRegExp(name)}$`) }); +/** How far a computed `box-shadow` reaches below its element: the largest y offset plus blur plus + * spread over its outer layers. An inset layer paints inside the box and reaches nothing. */ +const shadowReach = (boxShadow: string): number => + boxShadow + .split(/,(?![^(]*\))/) + .filter((layer) => !layer.includes('inset')) + .reduce((reach, layer) => { + const lengths = layer.replace(/\([^)]*\)/g, '').match(/-?\d*\.?\d+/g) ?? []; + const [, y = 0, blur = 0, spread = 0] = lengths.map(Number); + return Math.max(reach, y + blur + spread); + }, 0); + test.describe('ask question batch refinements', () => { test('Enter in an answer field confirms the step instead of sending the composer @scenario:ask-batch-enter-confirms-answer', async ({ page, @@ -352,6 +364,39 @@ test.describe('ask question batch refinements', () => { } }); + test('the batch card leaves no shadow band between it and the composer @scenario:ask-batch-card-leaves-no-shadow-band', async ({ + page, + }) => { + test.setTimeout(120000); + const label = `${Date.now()}-${Math.floor(Math.random() * 1e4)}`; + let agentId: string | undefined; + + try { + const agent = await createAgent(page); + agentId = agent.id; + await openBatch(page, agent, label); + const popover = await openPopover(page); + const surface = page.getByTestId('composer-surface'); + + /* The card floats a small gap above the composer. A shadow that reaches further than that + gap never fades out inside it: the whole strip stays tinted and reads as a dark band + under the card's own border. */ + const slack = async () => { + const [card, composer, boxShadow] = await Promise.all([ + popover.boundingBox(), + surface.boundingBox(), + popover.evaluate((element) => getComputedStyle(element).boxShadow), + ]); + expect(card).not.toBeNull(); + expect(composer).not.toBeNull(); + return composer!.y - (card!.y + card!.height) - shadowReach(boxShadow); + }; + await expect.poll(slack, { timeout: 5000 }).toBeGreaterThanOrEqual(0); + } finally { + await cleanupAgent(page, agentId); + } + }); + test('a typed answer deselects the option and locks the rows until cleared @scenario:ask-typed-answer-locks-options', async ({ page, }) => { diff --git a/packages/chat/src/components/composer/ask/Popover.tsx b/packages/chat/src/components/composer/ask/Popover.tsx index fa7c57cda5..6080c2529c 100644 --- a/packages/chat/src/components/composer/ask/Popover.tsx +++ b/packages/chat/src/components/composer/ask/Popover.tsx @@ -140,7 +140,7 @@ function QuestionPanel({ return (
{ if (isCancelKey(e.nativeEvent) && !e.nativeEvent.isComposing) { e.preventDefault(); @@ -266,7 +266,7 @@ export default function AskPopover({
{/* The prompt and answers scroll within their own caps; this outer cap keeps the card on screen when both are at their limit on a short viewport. */} -
+
{renderQuestions({ liveAsk, questions: liveAsk.questions,