Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-ui): stop horizontal overflow in narrow chat drawer

Diego Zacarias9f9ea5c9a19b
diff --git a/desktop-app/ui/src/__tests__/chatDrawerNoHorizontalOverflow.test.ts b/desktop-app/ui/src/__tests__/chatDrawerNoHorizontalOverflow.test.ts
new file mode 100644
index 000000000..228112d78
--- /dev/null
+++ b/desktop-app/ui/src/__tests__/chatDrawerNoHorizontalOverflow.test.ts
@@ -0,0 +1,71 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import path from 'node:path'
+
+// Regression guard for the narrow chat DRAWER (min width 340px) overflowing
+// horizontally: the empty-state greeting header and the composer action row used
+// to exceed the slim column and surface a horizontal scrollbar on
+// `.chat-drawer__surface`. The full-screen chat route (same <ChatPage>) never had
+// this because it wraps the workspace in `.chat-view-surface`, whose 0 width-floor
+// + `overflow: hidden` clip it.
+//
+// A real layout assertion (`scrollWidth <= clientWidth` at 340px) is the ideal
+// test, but this renderer has NO vitest browser-mode harness — the unit suite runs
+// under jsdom, which performs no layout (every element reports scrollWidth 0), and
+// the only real-layout lane is the heavy Playwright e2e that needs a live cluster.
+// So this pins the CSS contract that makes the overflow impossible, at the source
+// level, scoped entirely under `.chat-drawer` (the full-screen path is untouched).
+// Whitespace-normalized copy so a rule can be located regardless of how its
+// selector list is wrapped across lines in the source.
+const styles = readFileSync(path.join(process.cwd(), 'ui/src/styles.css'), 'utf8').replace(
+ /\s+/g,
+ ' '
+)
+
+/** Return the declaration body of the first rule whose selector list matches. */
+function ruleBody(selector: string): string {
+ const normalized = selector.replace(/\s+/g, ' ').trim()
+ const escaped = normalized.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+ const match = styles.match(new RegExp(`(?:^|[};/]) ?${escaped} ?{([^}]*)}`))
+ if (!match) throw new Error(`rule not found: ${selector}`)
+ return match[1]
+}
+
+describe('chat drawer — no horizontal overflow', () => {
+ it('gives the drawer scroll host a 0 width-floor and clips overflow-x', () => {
+ const body = ruleBody('.chat-drawer__surface')
+ expect(body).toMatch(/min-width:\s*0/)
+ expect(body).toMatch(/overflow-x:\s*hidden/)
+ // overflow-y stays scrollable — only the horizontal axis is clipped.
+ expect(body).toMatch(/overflow-y:\s*auto/)
+ })
+
+ it('propagates the width-floor down the drawer chat body chain', () => {
+ const body = ruleBody(
+ '.chat-drawer .agent-page,\n.chat-drawer .agent-workspace-shell,\n.chat-drawer .agent-workspace-body-slot'
+ )
+ expect(body).toMatch(/min-width:\s*0/)
+ })
+
+ it('lets the drawer greeting row wrap, step down type, and shrink the selector', () => {
+ expect(ruleBody('.chat-drawer .agent-workspace-shell .agent-workspace-greeting-row')).toMatch(
+ /flex-wrap:\s*wrap/
+ )
+ // Heading + selector trigger drop from the full-screen 2xl to an lg step.
+ expect(
+ ruleBody(
+ '.chat-drawer .agent-workspace-greeting-row .agent-workspace-greeting,\n.chat-drawer .agent-workspace-greeting-row .agent-title-selector-trigger.ui-button,\n.chat-drawer .agent-workspace-greeting-row .agent-title-selector-trigger.ui-button--sm'
+ )
+ ).toMatch(/font-size:\s*var\(--font-size-lg\)/)
+ const selector = ruleBody('.chat-drawer .agent-workspace-greeting-row .agent-title-selector')
+ expect(selector).toMatch(/flex:\s*0 1 auto/)
+ expect(selector).toMatch(/min-width:\s*0/)
+ })
+
+ it('lets the drawer composer action row wrap and its right cluster shrink', () => {
+ expect(ruleBody('.chat-drawer .composer-input-actions')).toMatch(/flex-wrap:\s*wrap/)
+ const right = ruleBody('.chat-drawer .composer-actions-right')
+ expect(right).toMatch(/min-width:\s*0/)
+ expect(right).toMatch(/flex:\s*0 1 auto/)
+ })
+})
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index e868a8087..1a07b2d5e 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -13315,6 +13315,17 @@ pre {
height: 100%;
}
+/* Propagate the 0 width-floor down the chat body chain so no descendant's
+ min-content (the greeting heading, the composer action row) inflates the slim
+ column and reintroduces the horizontal scrollbar the surface just clipped.
+ Full-screen gets this from `.chat-view-surface__content > .agent-page`, which
+ the drawer's <ChatPage> renders outside of; this mirrors it, scoped here. */
+.chat-drawer .agent-page,
+.chat-drawer .agent-workspace-shell,
+.chat-drawer .agent-workspace-body-slot {
+ min-width: 0;
+}
+
.chat-drawer .agent-workspace-shell .chat-thread {
padding: var(--space-2);
}
@@ -13351,6 +13362,26 @@ pre {
use; keep the base rule's hero top offset and bottom padding intact. */
.chat-drawer .agent-workspace-shell .agent-workspace-greeting-row {
padding-inline: var(--space-2);
+ /* The slim column can't fit the greeting + agent selector on one line at the
+ full-screen 2xl size, so let them wrap and step the type down to lg. */
+ flex-wrap: wrap;
+}
+
+.chat-drawer .agent-workspace-greeting-row .agent-workspace-greeting,
+.chat-drawer .agent-workspace-greeting-row .agent-title-selector-trigger.ui-button,
+.chat-drawer .agent-workspace-greeting-row .agent-title-selector-trigger.ui-button--sm {
+ font-size: var(--font-size-lg);
+}
+
+/* Let the agent selector shrink and its label ellipsize instead of forcing the
+ row wider than the column (full-screen pins it at `flex: 0 0 auto`). */
+.chat-drawer .agent-workspace-greeting-row .agent-title-selector {
+ flex: 0 1 auto;
+ min-width: 0;
+}
+
+.chat-drawer .agent-workspace-greeting-row .agent-title-selector-trigger {
+ min-width: 0;
}
.chat-drawer .composer {
@@ -13358,6 +13389,19 @@ pre {
padding: var(--space-2);
}
+/* The composer action row packs the agent selector, reference toolbar, model
+ chip and send button; at full-screen widths they sit on one line, but their
+ combined min-content exceeds the slim column. Let the row wrap and the
+ right-hand cluster shrink so it reflows instead of forcing the column wider. */
+.chat-drawer .composer-input-actions {
+ flex-wrap: wrap;
+}
+
+.chat-drawer .composer-actions-right {
+ min-width: 0;
+ flex: 0 1 auto;
+}
+
/* Tighter table cells so the data table breathes in the slim column; the
`.da-table__scroll` horizontal overflow still handles anything too wide. */
.chat-drawer .da-table {
@@ -13406,6 +13450,14 @@ pre {
.chat-drawer__surface {
flex: 1 1 auto;
min-height: 0;
+ /* min-width:0 establishes a 0 width-floor so the embedded chat's min-content
+ can't inflate this fixed rail wider than the drawer; overflow-x:hidden clips
+ any residual. Per CSS spec `overflow-y:auto` with a `visible` overflow-x
+ would compute overflow-x to `auto` and surface a horizontal scrollbar — this
+ pins it to `hidden`. The full-screen route gets the same floor/clip from
+ `.chat-view-surface`, which the drawer's <ChatPage> renders outside of. */
+ min-width: 0;
+ overflow-x: hidden;
overflow-y: auto;
display: flex;
flex-direction: column;