Skip to content

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

TypeScript

fix(desktop-app): reserve chat-drawer toggle slot in the titlebar

Diego Zacarias586353f995cf
diff --git a/desktop-app/ui/src/components/AppHeader/__tests__/chatDrawerToggle.test.tsx b/desktop-app/ui/src/components/AppHeader/__tests__/chatDrawerToggle.test.tsx
index c11906975..9659787dd 100644
--- a/desktop-app/ui/src/components/AppHeader/__tests__/chatDrawerToggle.test.tsx
+++ b/desktop-app/ui/src/components/AppHeader/__tests__/chatDrawerToggle.test.tsx
@@ -4,8 +4,10 @@ import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { AppHeader } from '../index'
// Mini-spec 04a §C/R3: the chat-drawer toggle lives in the app header, between
-// the search and the notification bell. It renders only when `drawerAvailable`
-// (never on a chat tab) and drives `onToggleChatDrawer`.
+// the search and the notification bell. The interactive button renders only when
+// `drawerAvailable` (never on a chat tab) and drives `onToggleChatDrawer`. When
+// the drawer is unavailable but the handler is wired, an inert placeholder holds
+// the toggle's slot so hiding it doesn't reflow the search pill and bell.
vi.mock('@hooks/domain/useAgentsDataController', () => ({
useAgentsDataController: () => ({ accessCatalog: null }),
@@ -68,11 +70,44 @@ describe('AppHeader chat-drawer toggle', () => {
expect(screen.queryByRole('button', { name: 'Open chat drawer' })).toBeNull()
})
+ it('reserves the toggle slot with an inert placeholder on a chat tab', () => {
+ const { container } = render(
+ <AppHeader placement="titlebar" drawerAvailable={false} onToggleChatDrawer={vi.fn()} />
+ )
+ // The interactive control is gone, but its slot is held so the search pill
+ // and bell keep their position when the toggle appears/disappears.
+ const placeholder = screen.getByTestId('chat-drawer-toggle-placeholder')
+ expect(placeholder.tagName).toBe('SPAN')
+ expect(placeholder.getAttribute('aria-hidden')).toBe('true')
+ // Carries `.chat-drawer-toggle` — the class that sizes the box — so it
+ // reserves the real toggle's footprint (jsdom can't measure layout, so the
+ // shared sizing class is the closest guard against the slot collapsing).
+ expect(placeholder.classList.contains('chat-drawer-toggle')).toBe(true)
+
+ // Same position as the real toggle: between the search (.header-left) and the
+ // bell (.header-utilities).
+ const left = container.querySelector('.header-left')
+ const utilities = container.querySelector('.header-utilities')
+ expect(left).not.toBeNull()
+ expect(utilities).not.toBeNull()
+ expect(
+ left!.compareDocumentPosition(placeholder) & Node.DOCUMENT_POSITION_FOLLOWING
+ ).toBeTruthy()
+ expect(
+ placeholder.compareDocumentPosition(utilities!) & Node.DOCUMENT_POSITION_FOLLOWING
+ ).toBeTruthy()
+ })
+
it('is hidden when no toggle handler is wired', () => {
render(<AppHeader placement="titlebar" drawerAvailable={true} />)
expect(screen.queryByTestId('chat-drawer-toggle')).toBeNull()
})
+ it('reserves no slot when no toggle handler is wired', () => {
+ render(<AppHeader placement="titlebar" drawerAvailable={false} />)
+ expect(screen.queryByTestId('chat-drawer-toggle-placeholder')).toBeNull()
+ })
+
it('renders between search and bell on a non-chat tab, reflecting the closed state', () => {
const { container } = render(
<AppHeader
diff --git a/desktop-app/ui/src/components/HeaderActions/index.tsx b/desktop-app/ui/src/components/HeaderActions/index.tsx
index 26c111c88..d2eaadd53 100644
--- a/desktop-app/ui/src/components/HeaderActions/index.tsx
+++ b/desktop-app/ui/src/components/HeaderActions/index.tsx
@@ -645,22 +645,32 @@ export const HeaderActions = React.memo(function HeaderActions({
</div>
{/* Chat-drawer toggle (mini-spec 04a §C/R3): between the search and the
- bell. Hidden on chat tabs (`!drawerAvailable`), where the chat IS the
- content. Ghost style like the bell (`--titlebar` variant). */}
- {drawerAvailable && onToggleChatDrawer ? (
- <IconButton
- className="chat-drawer-toggle"
- data-testid="chat-drawer-toggle"
- color="neutral"
- variant="ghost"
- aria-label={chatDrawerOpen ? 'Close chat drawer' : 'Open chat drawer'}
- aria-pressed={chatDrawerOpen}
- label={chatDrawerOpen ? 'Close chat drawer' : 'Open chat drawer'}
- title={chatDrawerOpen ? 'Close chat drawer' : 'Open chat drawer'}
- onClick={onToggleChatDrawer}
- >
- <IconChat />
- </IconButton>
+ bell. Ghost style like the bell (`--titlebar` variant). On chat tabs
+ (`!drawerAvailable`) the chat IS the content, so the interactive button
+ is gone — but an inert, same-size placeholder holds its slot so hiding
+ the toggle doesn't reflow the search pill and bell sideways. */}
+ {onToggleChatDrawer ? (
+ drawerAvailable ? (
+ <IconButton
+ className="chat-drawer-toggle"
+ data-testid="chat-drawer-toggle"
+ color="neutral"
+ variant="ghost"
+ aria-label={chatDrawerOpen ? 'Close chat drawer' : 'Open chat drawer'}
+ aria-pressed={chatDrawerOpen}
+ label={chatDrawerOpen ? 'Close chat drawer' : 'Open chat drawer'}
+ title={chatDrawerOpen ? 'Close chat drawer' : 'Open chat drawer'}
+ onClick={onToggleChatDrawer}
+ >
+ <IconChat />
+ </IconButton>
+ ) : (
+ <span
+ className="chat-drawer-toggle chat-drawer-toggle--placeholder"
+ data-testid="chat-drawer-toggle-placeholder"
+ aria-hidden="true"
+ />
+ )
) : null}
<div className="header-utilities">
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index b228d658d..8edf454d3 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -13647,7 +13647,13 @@ pre {
absorb the row's free space and shove the search pill to the far left, on top
of the app's leading actions. */
.window-titlebar__actions .chat-drawer-toggle {
- width: 30px;
+ /* 36px wide to match the bell's footprint: the real toggle is an IconButton,
+ whose `.ui-icon-button` base pins `min-width: 36px`, so its used width is 36
+ regardless of this `width`. Pin `min-width` here too so the placeholder span
+ (which lacks `.ui-icon-button`) reserves the identical 36px — otherwise it
+ collapses to 30px and the search pill still shifts ~6px on toggle. */
+ width: 36px;
+ min-width: 36px;
height: 30px;
min-height: 30px;
border-color: transparent;
@@ -13672,6 +13678,15 @@ pre {
background: var(--surface-hover);
}
+/* Slot-reserving twin of the chat-drawer toggle. On chat tabs the real button
+ is unmounted, but this inert placeholder shares `.chat-drawer-toggle`'s box
+ (same 36px footprint + top-bar gap) so the toggle appears/disappears in place
+ without sliding the search pill and bell sideways. */
+.window-titlebar__actions .chat-drawer-toggle--placeholder {
+ visibility: hidden;
+ pointer-events: none;
+}
+
:root[data-theme='dark'] .window-titlebar__actions .search-input {
border-color: var(--titlebar-action-border) !important;
background: var(--titlebar-action-surface) !important;