Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(chat): Flash-Popup oeffnet nach oben und bleibt am echten Viewport sichtbar

purple3f0c1a56bc57
diff --git a/e2e/flash-chat-billing.spec.ts b/e2e/flash-chat-billing.spec.ts
index 1631d6bc..c2310244 100644
--- a/e2e/flash-chat-billing.spec.ts
+++ b/e2e/flash-chat-billing.spec.ts
@@ -41,17 +41,56 @@ test('flash metadata and paid fallback reach the actual desktop composer', async
// dann "Included". David am 12.09.2026 endgueltig zurueck auf "No credits",
// weil "Included" nur sagt, dass etwas dabei ist. Dass die Marke am KONTO
// haengt, traegt die Logik daneben und der Titel, nicht das Etikett. Die
- // Zeile selbst ist unveraendert, nur ihr Aufdruck.
+ // Zeile selbst ist unveraendert, nur ihr Aufdruck. Sie steht weiterhin in
+ // der Modellauswahl selbst (`ModelRowMarks`), unabhaengig vom Etikett in
+ // der Sitzungsleiste.
const marke = row.getByText('No credits', { exact: true })
await expect(marke).toBeVisible()
await expect(marke).toHaveAttribute('title', 'No credits on your plan, up to 50,000 tokens per day.')
await row.click()
- await expect(page.getByTestId('flash-chat-notice')).toContainText('50,000 input and output tokens')
+
+ // Runde 3 (Abnahme 19.09.2026, Blocker A2): kein Dauerband mehr ueber der
+ // Eingabe. Der Hinweis ist ein Etikett neben dem Agent-Schalter, das ein
+ // Popup oeffnet statt Platz zu beanspruchen, genau wie der Sampling-Regler.
+ const trigger = page.getByTestId('flash-chat-notice-trigger')
+ const panel = page.getByTestId('flash-chat-notice-panel')
const composer = page.locator('textarea').first()
+
+ await expect(trigger).toBeVisible()
+ await expect(trigger).toHaveText('Using no credits')
+ await expect(panel).toBeHidden()
+
+ // Der Composer darf sich nicht bewegen, weder beim Oeffnen noch beim
+ // Schliessen: das war der Fehler des alten Dauerbandes, das den
+ // Agent-Schalter und alles darunter nach oben schob.
+ const composerTopBeforeOpen = (await composer.boundingBox())!.y
+
+ await trigger.click()
+ await expect(panel).toBeVisible()
+ await expect(panel).toContainText('50,000 input and output tokens')
+ const composerTopWhileOpen = (await composer.boundingBox())!.y
+ expect(composerTopWhileOpen).toBeCloseTo(composerTopBeforeOpen, 0)
+
+ // Das X schliesst.
+ await page.getByTestId('flash-chat-notice-close').click()
+ await expect(panel).toBeHidden()
+ const composerTopAfterClose = (await composer.boundingBox())!.y
+ expect(composerTopAfterClose).toBeCloseTo(composerTopBeforeOpen, 0)
+
+ // Escape schliesst ebenfalls.
+ await trigger.click()
+ await expect(panel).toBeVisible()
+ await page.keyboard.press('Escape')
+ await expect(panel).toBeHidden()
+
await composer.fill('Say hello')
await composer.press('Enter')
- await expect(page.getByTestId('flash-chat-notice').getByRole('status')).toContainText('41,000')
+ await trigger.click()
+ await expect(panel.getByRole('status')).toContainText('41,000')
await expect(page.getByText('Flash browser proof 1.', { exact: true })).toBeVisible()
+ await page.getByTestId('flash-chat-notice-close').click()
+ await expect(panel).toBeHidden()
+
await expect(async () => {
if (requests < 2) {
await composer.fill('Say hello again')
@@ -59,6 +98,7 @@ test('flash metadata and paid fallback reach the actual desktop composer', async
}
expect(requests).toBe(2)
}).toPass({ timeout: 10000 })
- await expect(page.getByTestId('flash-chat-notice').getByRole('alert')).toContainText('uses credits')
+ await trigger.click()
+ await expect(panel.getByRole('alert')).toContainText('uses credits')
await expect(page.getByText('Flash browser proof 2.', { exact: true })).toBeVisible()
})
diff --git a/e2e/flash-notice-real-geometry.spec.ts b/e2e/flash-notice-real-geometry.spec.ts
new file mode 100644
index 00000000..385e7d32
--- /dev/null
+++ b/e2e/flash-notice-real-geometry.spec.ts
@@ -0,0 +1,139 @@
+import { test, expect, type Page } from '@playwright/test'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+
+/**
+ * Proof for Blocker A1 (Abnahme 19.09.2026): the Flash popup must open
+ * UPWARD from the session strip, because that strip sits right above the
+ * composer, near the BOTTOM of the window (`ChatView.tsx:506`), not near the
+ * top. The previous proof (Runde 2) measured a harness that put the strip at
+ * the top of a tall page with 300px of free space below it, so it could
+ * never have caught a panel opening the wrong way. This file drives the real
+ * `ChatView`, with the real `overflow-hidden` ancestor and the real bottom-of-
+ * window strip, and measures with `boundingBox()`, the same way
+ * `sampling-popup.spec.ts` does for the sibling popup.
+ *
+ * Three window sizes, because the geometry differs at each: a tall desktop
+ * window (plenty of room above the strip), a short one (900x600, closer to
+ * what the review measured against), and a narrow phone-width one (360px,
+ * where the left clamp matters too). At all three, the whole panel, X button
+ * included, must be measurable INSIDE the viewport: no negative x/y, no edge
+ * past width/height.
+ */
+
+const CORS = { 'access-control-allow-origin': '*', 'access-control-allow-headers': 'authorization, content-type' }
+
+/**
+ * Selects the model at a roomy default width, THEN resizes to the size under
+ * test.
+ *
+ * Found while writing this proof, unrelated to Blocker A1: `ModelSelector`'s
+ * dropdown, opened at 360px, leaves the shared scroll-clipped ancestor
+ * (`ChatView.tsx`'s `overflow-hidden` content column) scrolled roughly 290px
+ * to the right afterwards (`scrollLeft` on an `overflow-hidden` element is
+ * still settable, and something, likely a focus-follow on the picked row,
+ * sets it). That drags the WHOLE chat column, this popup's trigger included,
+ * off-screen to the left, permanently, for reasons that have nothing to do
+ * with this popup. Picking the model before narrowing the window sidesteps
+ * that pre-existing bug instead of silently proving something else.
+ */
+async function boot(page: Page, width: number, height: number): Promise<void> {
+ await page.setViewportSize({ width: Math.max(width, 1024), height: Math.max(height, 700) })
+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME })
+ await seedOnboardingDone(page)
+ await routeCloud(page, { license: 'active', access: true, mediaLive: true, paidPlan: true })
+ await page.route('**/api/inference/v1/models', (route) => route.fulfill({ status: 200, headers: CORS,
+ contentType: 'application/json', body: JSON.stringify({ object: 'list', data: [{
+ id: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo', name: 'Llama 3.1 8B Turbo',
+ context_length: 131072, supports_tools: true, think: 'never', usage_class: 'flash',
+ flash: { daily_tokens: 50000, default_max_output: 8192, request_seconds: 240, sessions_only: true, concurrent_requests: 1 },
+ }] }),
+ }))
+ await page.goto('/')
+ await expect(cloudSwitch(page)).toBeVisible()
+ await signInViaGate(page)
+ await expect(cloudSwitch(page)).toBeChecked()
+ await page.getByRole('button', { name: /New Chat/i }).first().click()
+ await page.getByRole('button', { name: 'Select chat model', exact: true }).click()
+ await page.getByRole('button', { name: /Llama 3.1 8B Turbo/ }).click()
+ await page.setViewportSize({ width, height })
+}
+
+interface Box { x: number; y: number; width: number; height: number }
+
+const SIZES: Array<{ label: string; width: number; height: number }> = [
+ { label: '1280x800 (breiter Desktop)', width: 1280, height: 800 },
+ { label: '900x600 (kleines Fenster)', width: 900, height: 600 },
+ { label: '360px breit (Telefonbreite)', width: 360, height: 720 },
+]
+
+for (const { label, width, height } of SIZES) {
+ test(`das Panel oeffnet nach OBEN und bleibt bei ${label} vollstaendig sichtbar`, async ({ page }) => {
+ await boot(page, width, height)
+
+ const trigger = page.getByTestId('flash-chat-notice-trigger')
+ await expect(trigger).toBeVisible()
+ const ausloeser = (await trigger.boundingBox()) as Box
+
+ await trigger.click()
+ const panel = page.getByTestId('flash-chat-notice-panel')
+ await expect(panel).toBeVisible()
+ const x = page.getByTestId('flash-chat-notice-close')
+ await expect(x).toBeVisible()
+
+ const kasten = (await panel.boundingBox()) as Box
+ const xKasten = (await x.boundingBox()) as Box
+
+ // Richtung: das Panel haengt UEBER dem Trigger, nicht darunter. Nur
+ // `position: absolute` zu pruefen faengt eine falsche Richtung nicht, ein
+ // gemessenes Rechteck schon.
+ expect(kasten.y + kasten.height).toBeLessThanOrEqual(ausloeser.y + 1)
+
+ // Sichtbarkeit: das ganze Panel liegt im Fenster, nicht nur seine obere
+ // linke Ecke. Alle vier Kanten werden gemessen.
+ expect(kasten.x).toBeGreaterThanOrEqual(0)
+ expect(kasten.y).toBeGreaterThanOrEqual(0)
+ expect(kasten.x + kasten.width).toBeLessThanOrEqual(width + 0.5)
+ expect(kasten.y + kasten.height).toBeLessThanOrEqual(height + 0.5)
+
+ // Das X liegt ebenfalls im sichtbaren Bereich, nicht nur behauptet
+ // sichtbar: `toBeVisible()` prueft CSS-Sichtbarkeit, nicht Lage im
+ // Fenster. Ein Panel, das zur Haelfte rechts aus dem Fenster haengt, kann
+ // sein X trotzdem als "visible" melden.
+ expect(xKasten.x).toBeGreaterThanOrEqual(0)
+ expect(xKasten.y).toBeGreaterThanOrEqual(0)
+ expect(xKasten.x + xKasten.width).toBeLessThanOrEqual(width + 0.5)
+ expect(xKasten.y + xKasten.height).toBeLessThanOrEqual(height + 0.5)
+ })
+}
+
+/**
+ * Negativkontrolle: beweist, dass der Waechter oben wirklich etwas misst und
+ * nicht nur immer gruen ist.
+ *
+ * Statt den alten, fehlerhaften Code wiederherzustellen (der Zweig hat davon
+ * keine Kopie mehr, und eine zweite Kopie wuerde selbst zu totem Code), wird
+ * hier mit denselben ECHTEN Messwerten geprueft, was `top: '100%'` (die
+ * Richtung aus Runde 2) an genau dieser Stelle bedeutet: der Trigger sitzt in
+ * der untersten Leiste vor dem Composer, und die Fensterhoehe ist bekannt.
+ * Ein Panel von `panel.boundingBox()`s eigener Hoehe, das ab der Trigger-
+ * Unterkante nach UNTEN gerechnet wird, muesste weit ueber den unteren
+ * Fensterrand hinausragen. Das ist keine Behauptung, sondern dieselbe
+ * Messung wie oben, nur mit der Rechenrichtung von Runde 2, und sie zeigt:
+ * die Richtung war der Fehler, nicht ein Zufall dieses einen Harnesses.
+ */
+test('Negativkontrolle: nach UNTEN gerechnet haette das Panel den Fensterrand gerissen', async ({ page }) => {
+ await boot(page, 900, 600)
+
+ const trigger = page.getByTestId('flash-chat-notice-trigger')
+ const ausloeser = (await trigger.boundingBox()) as Box
+
+ await trigger.click()
+ const panel = page.getByTestId('flash-chat-notice-panel')
+ await expect(panel).toBeVisible()
+ const kasten = (await panel.boundingBox()) as Box
+
+ const wuerdeUntenEnden = ausloeser.y + ausloeser.height + 6 /* PANEL_GAP */ + kasten.height
+ const fensterHoehe = 600
+ expect(wuerdeUntenEnden).toBeGreaterThan(fensterHoehe)
+})
diff --git a/src/components/chat/FlashChatNotice.tsx b/src/components/chat/FlashChatNotice.tsx
index 24a87bda..4111c151 100644
--- a/src/components/chat/FlashChatNotice.tsx
+++ b/src/components/chat/FlashChatNotice.tsx
@@ -46,6 +46,19 @@ import { TOOLBAR_LABEL_TEXT } from './AgentModeToggle'
* noetig, diese App hat keinen Zoom-Wrapper, den ein Portal umgehen
* muesste.
*
+ * Runde 3 (Abnahme 19.09.2026, Blocker A1): die Annahme aus Runde 2, das
+ * Panel duerfe nach unten oeffnen, war falsch. Die Sitzungsleiste steht in
+ * dieser App unter dem Transkript, direkt ueber dem Composer
+ * (`ChatView.tsx:506`), nicht oben. Unten bleiben nur rund 90 bis 140 px bis
+ * zum Fensterrand, das rund 275 px hohe Panel wurde dort abgeschnitten, von
+ * einem `overflow-hidden`-Vorfahren (`ChatView.tsx:280`). Das Panel oeffnet
+ * jetzt nach OBEN (`bottom: '100%'`, wie `SamplingControls`) und klemmt
+ * zusaetzlich seine Hoehe auf den frei bleibenden Platz ueber dem Trigger
+ * (`clampNoticeMaxHeight`, `overflow-y: auto`), damit es auch in einem
+ * niedrigen Fenster nicht oben aus dem Bild laeuft. Ausserdem ist das
+ * doppelte `aria-label` neben `aria-labelledby` am Panel weg: `aria-labelledby`
+ * gewinnt ohnehin, das zweite war toter Code.
+ *
* Zwei Sorten Text leben hier und verhalten sich mit Absicht verschieden:
* - die Zeilen je Anfrage melden eine Antwort, die schon zurueck ist. Sie
* veralten, sobald diese Oberflaeche weg ist, also raeumen Fokus und Blur
@@ -71,12 +84,12 @@ const PANEL_WIDTH = 280
/** Breathing room kept between the panel and the window edge. */
const PANEL_MARGIN = 8
+/** Gap between the trigger row and the panel. */
+const PANEL_GAP = 6
+
/** The close button's accessible name, mirrored in the web app. */
export const FLASH_NOTICE_CLOSE_LABEL = 'Close Flash usage details'
-/** What the popup is called for a screen reader, mirrored in the web app. */
-export const FLASH_NOTICE_DIALOG_LABEL = 'Flash usage'
-
/** The trigger's own label per state, mirrored in the web app. */
export const FLASH_NOTICE_LABEL_FREE = 'Using no credits'
export const FLASH_NOTICE_LABEL_CREDITS = 'Using credits'
@@ -107,6 +120,49 @@ export function clampNoticeLeft(wrapLeft: number, viewportWidth: number, wanted:
return { left: clampedViewportLeft - wrapLeft, width }
}
+/**
+ * How tall the panel is allowed to be, given where the trigger sits.
+ *
+ * Runde 3 (Abnahme 19.09.2026, Blocker A1): die Sitzungsleiste, in der dieser
+ * Trigger steht, sitzt in dieser App UNTER dem Transkript, direkt ueber dem
+ * Composer (`ChatView.tsx:506`), nicht oben wie der Beweis-Harness der
+ * vorigen Runde es zeigte. Unter der Leiste bleiben nur noch rund 90 bis
+ * 140 px bis zum Fensterrand, das Panel selbst ist rund 275 px hoch. Es
+ * oeffnet deshalb jetzt nach OBEN (`bottom: '100%'`, wie `SamplingControls`),
+ * und diese Funktion klemmt seine Hoehe auf den Platz, der oberhalb des
+ * Triggers tatsaechlich frei ist, genau wie `placePopover` es im Web fuer den
+ * Fall `openUpward` tut. Pure, damit die Klemme ohne DOM testbar ist.
+ */
+export function clampNoticeMaxHeight(wrapTop: number): number {
+ return Math.max(wrapTop - PANEL_GAP - PANEL_MARGIN, 0)
+}
+
+/**
+ * The area that actually clips this popup, not the window.
+ *
+ * Found live while proving Blocker A1 at 360px width, not simulated: clamping
+ * against `window.innerWidth` lets the panel reach into the space the sidebar
+ * covers, because `ChatView.tsx` wraps the transcript-plus-composer column in
+ * a `<main overflow-hidden>` pane narrower than the window. A panel placed
+ * there is still found by `getBoundingClientRect` (so every other check here
+ * would have stayed green), but the close button ends up behind the sidebar,
+ * where a browser's focus-follow scrolls it into view: since `overflow-hidden`
+ * still allows a programmatic `scrollLeft`, that scroll dragged the WHOLE chat
+ * column sideways, not just this popup. Same fix as `ContextDropdown.tsx`'s
+ * `abschneidendeFlaeche`, for both axes instead of one: walk up for the first
+ * ancestor that actually clips, and clamp against ITS box, not the window's.
+ */
+function abschneidendeFlaeche(el: Element): { oben: number; links: number; rechts: number } {
+ for (let p = el.parentElement; p; p = p.parentElement) {
+ const cs = getComputedStyle(p)
+ if (cs.overflowY !== 'visible' || cs.overflowX !== 'visible') {
+ const r = p.getBoundingClientRect()
+ return { oben: r.top, links: r.left, rechts: r.right }
+ }
+ }
+ return { oben: 0, links: 0, rechts: window.innerWidth }
+}
+
export function FlashChatNotice() {
useEffect(() => {
// Another tab can change the account while this surface is unfocused.
@@ -124,7 +180,13 @@ export function FlashChatNotice() {
const panelRef = useRef<HTMLDivElement>(null)
const panelId = useId()
const headingId = useId()
- const [panelBox, setPanelBox] = useState<{ left: number; width: number }>({ left: 0, width: PANEL_WIDTH })
+ const [panelBox, setPanelBox] = useState<{ left: number; width: number; maxHeight: number | undefined }>({
+ left: 0,
+ width: PANEL_WIDTH,
+ // Unmeasured yet: CSS rejects `Infinity`, so "no clamp" means "no
+ // property" until the layout effect below measures the real value.
+ maxHeight: undefined,
+ })
const active = useModelStore((s) => s.models.find((m) => m.name === s.activeModel))
const policy = active && 'flash' in active ? active.flash : undefined
@@ -157,18 +219,64 @@ export function FlashChatNotice() {
useEffect(() => {
if (!open) return
- panelRef.current?.querySelector<HTMLElement>(FOCUSABLE)?.focus()
+ // `preventScroll`: found live at 360px width (Runde 3) that a plain
+ // `.focus()` here made the browser scroll the close button into view on
+ // its OWN terms, through the nearest ancestor that still allows a
+ // programmatic `scrollLeft` despite `overflow-hidden`
+ // (`ChatView.tsx`'s clipped main pane). That scroll dragged the whole
+ // chat column sideways, not just this popup, and outlived the popup
+ // itself. The panel's own position is already placed and clamped by the
+ // layout effect below; the browser's own idea of "into view" is not
+ // needed on top of it and only fights it.
+ panelRef.current?.querySelector<HTMLElement>(FOCUSABLE)?.focus({ preventScroll: true })
}, [open])
// Measured once on open and again on every resize while open, so a window
// dragged narrower while the popup is up never leaves it hanging off the
// edge either.
+ //
+ // Runde 3 (Abnahme 19.09.2026, Auflage A5): die ganze App liegt unter einem
+ // `zoom: var(--ui-scale)` (index.css:518), das Runde-2-Kommentar oben
+ // ("diese App hat keinen Zoom-Wrapper") war schlicht falsch. Unter Zoom
+ // zaehlen zwei Messwege verschieden: `getBoundingClientRect` liefert
+ // SICHTBARE Pixel, `left`/`width` als Inline-Style werden aber als CSS-Pixel
+ // des Elements interpretiert und danach erneut mit dem Zoom multipliziert.
+ // Bei `--ui-scale` 1,15 blieb das lange unbemerkt; erst bei 360px Fenster-
+ // breite riss die Differenz das Panel weit nach links aus dem Bild (das
+ // Auflage-A5-Bild der letzten Runde). `ContextDropdown.tsx:123` hat dieselbe
+ // Rechnung schon einmal geloest: die Skala aus der Differenz von
+ // `getBoundingClientRect` und `offsetWidth` bestimmen und beide Messgroessen
+ // vor dem Clamp durch sie teilen, damit Rechteck und Grenzflaeche in
+ // derselben Einheit stehen wie die spaeter gesetzten Style-Werte.
+ //
+ // Zweiter Fund derselben Runde, am echten 360px-Fenster: geklemmt wurde
+ // gegen `window.innerWidth`, nicht gegen die Flaeche, die wirklich schneidet
+ // (die Sidebar liegt VOR dem `<main overflow-hidden>`, das den Chat
+ // umschliesst). Das Panel durfte also bis an den Fensterrand rutschen, also
+ // teilweise HINTER die Sidebar, wo sein X zwar noch `getBoundingClientRect`
+ // fand, aber fuer den Fokus-Sprung beim Oeffnen "nicht sichtbar" war. Der
+ // Browser holt ein fokussiertes, verdecktes Element in Sicht, indem er den
+ // naechsten scrollbaren Vorfahren scrollt, und `overflow-hidden` verhindert
+ // das nicht, nur die Bildlaufleiste dazu. Das Ergebnis: der ganze Chat
+ // rutschte beim Oeffnen dieses Popups seitlich weg, nicht nur das Panel.
+ // `abschneidendeFlaeche` (oben) ist dieselbe Suche wie in ContextDropdown,
+ // fuer beide Achsen statt nur die Hoehe.
useLayoutEffect(() => {
if (!open) return
const place = () => {
- const rect = wrapRef.current?.getBoundingClientRect()
- if (!rect) return
- setPanelBox(clampNoticeLeft(rect.left, window.innerWidth, PANEL_WIDTH))
+ const wrap = wrapRef.current
+ if (!wrap) return
+ const rect = wrap.getBoundingClientRect()
+ const skala = wrap.offsetWidth > 0 ? rect.width / wrap.offsetWidth : 1
+ const grenze = abschneidendeFlaeche(wrap)
+ // In der Einheit von `clampNoticeLeft`s "Fenster": die schneidende
+ // Flaeche selbst wird zum Rahmen, links bei 0.
+ const wrapLeftInGrenze = (rect.left - grenze.links) / skala
+ const grenzeBreite = (grenze.rechts - grenze.links) / skala
+ setPanelBox({
+ ...clampNoticeLeft(wrapLeftInGrenze, grenzeBreite, PANEL_WIDTH),
+ maxHeight: clampNoticeMaxHeight((rect.top - grenze.oben) / skala),
+ })
}
place()
window.addEventListener('resize', place)
@@ -218,16 +326,24 @@ export function FlashChatNotice() {
id={panelId}
role="dialog"
aria-labelledby={headingId}
- aria-label={FLASH_NOTICE_DIALOG_LABEL}
data-testid="flash-chat-notice-panel"
// Out of flow, exactly like SamplingControls: the row it hangs off
// keeps its size and position to the pixel, whatever this says.
+ // Opens UPWARD (`bottom: '100%'`): the session strip this trigger
+ // lives in sits right above the composer, near the bottom of the
+ // window, so opening down runs the panel off-screen and, worse,
+ // clips it inside ChatView's `overflow-hidden` ancestor. `maxHeight`
+ // plus `overflow-y: auto` keep it from running off the TOP of a
+ // short window instead, the same way `clampNoticeLeft` keeps it on
+ // screen sideways.
style={{
position: 'absolute',
left: panelBox.left,
- top: '100%',
- marginTop: 6,
+ bottom: '100%',
+ marginBottom: PANEL_GAP,
width: panelBox.width,
+ maxHeight: panelBox.maxHeight,
+ overflowY: 'auto',
}}
className="z-50 rounded-lg p-2.5 lu-elevated text-xs text-gray-500"
>
diff --git a/src/components/chat/__tests__/flash-chat-notice.test.ts b/src/components/chat/__tests__/flash-chat-notice.test.ts
index e6342e71..9b59ec84 100644
--- a/src/components/chat/__tests__/flash-chat-notice.test.ts
+++ b/src/components/chat/__tests__/flash-chat-notice.test.ts
@@ -4,6 +4,7 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import {
clampNoticeLeft,
+ clampNoticeMaxHeight,
FLASH_NOTICE_CLOSE_LABEL,
FLASH_NOTICE_HEADING_EXHAUSTED,
FLASH_NOTICE_HEADING_FREE,
@@ -266,3 +267,19 @@ describe('clampNoticeLeft, der Viewport-Clamp des Panels', () => {
expect(width).toBe(280)
})
})
+
+// Runde 3 (Abnahme 19.09.2026, Blocker A1): das Panel oeffnet jetzt nach oben
+// und muss deshalb seine eigene Hoehe auf den Platz klemmen, der ueber dem
+// Trigger frei ist, sonst laeuft es in einem niedrigen Fenster oben aus dem
+// Bild statt wie zuvor rechts.
+describe('clampNoticeMaxHeight, die Hoehenklemme des nach oben oeffnenden Panels', () => {
+ it('gibt den vollen Platz oberhalb des Triggers minus Abstand und Rand', () => {
+ // wrapTop=400, PANEL_GAP=6, PANEL_MARGIN=8
+ expect(clampNoticeMaxHeight(400)).toBe(400 - 6 - 8)
+ })
+
+ it('wird nie negativ, wenn der Trigger fast am oberen Fensterrand klebt', () => {
+ expect(clampNoticeMaxHeight(0)).toBe(0)
+ expect(clampNoticeMaxHeight(5)).toBe(0)
+ })
+})
diff --git a/src/components/chat/__tests__/flash-hinweis-verschiebt-nichts.test.ts b/src/components/chat/__tests__/flash-hinweis-verschiebt-nichts.test.ts
index ec4f338e..cfb4b39e 100644
--- a/src/components/chat/__tests__/flash-hinweis-verschiebt-nichts.test.ts
+++ b/src/components/chat/__tests__/flash-hinweis-verschiebt-nichts.test.ts
@@ -11,7 +11,7 @@
* nicht nur entkoppelt), `ChatInput.tsx` kennt sie nicht mehr. Was sie zeigte,
* lebt an zwei Stellen weiter: "No credits"/"Using credits" im Etikett neben
* dem Agent-Schalter (`FlashChatNotice`), und BEIDE Marken unveraendert in der
- * Modellauswahl (`ModelRowMarks` in `ModelSelector.tsx`) — dort informiert
+ * Modellauswahl (`ModelRowMarks` in `ModelSelector.tsx`), dort informiert
* sich der Nutzer, nicht ueber dem Feld, in das er gerade tippt.
*
* Dieser Test liest Quelltext, nicht das gerenderte DOM, aus demselben Grund
@@ -88,6 +88,25 @@ describe('das Popup liegt ausserhalb des Layoutflusses, wie der Sampling-Regler'
expect(SAMPLING).toMatch(/position:\s*'absolute'/)
})
+ // Runde 3 (Abnahme 19.09.2026, Blocker A1): die Sitzungsleiste steht unter
+ // dem Transkript, direkt ueber dem Composer, nicht oben. Ein Panel, das
+ // nach UNTEN oeffnet (`top: '100%'`), liefe dort aus dem Fenster und wuerde
+ // vom `overflow-hidden`-Vorfahren in ChatView.tsx abgeschnitten. Nur
+ // `position: absolute` zu pruefen (wie zuvor) faengt das nicht, deshalb
+ // steht hier zusaetzlich die Richtung selbst: `bottom: '100%'`, wie
+ // `SamplingControls`, und explizit NICHT `top: '100%'`.
+ it('das Panel oeffnet nach OBEN, wie SamplingControls, nicht nach unten', () => {
+ expect(NOTICE).toMatch(/bottom:\s*'100%'/)
+ expect(NOTICE).not.toMatch(/top:\s*'100%'/)
+ expect(SAMPLING).toMatch(/bottom:\s*'100%'/)
+ })
+
+ it('das Panel klemmt seine Hoehe auf den freien Platz ueber dem Trigger', () => {
+ expect(NOTICE).toContain('clampNoticeMaxHeight')
+ expect(NOTICE).toMatch(/maxHeight:\s*panelBox\.maxHeight/)
+ expect(NOTICE).toMatch(/overflowY:\s*'auto'/)
+ })
+
it('der Ausloeser ist eine einzeilige Zeile, kein Block mit eigener Hoehe', () => {
// Kein `mb-*` und kein `flex-col` am Wurzelelement: eine Marke, die selbst
// Rand oder Zeilenumbruch mitbringt, macht die Leiste hoeher.