Skip to content

The agent that grows with you

refactor(desktop): one composerInputBacking constant for both composer paint layers; fix stale HUD comment; fold tests

kshitijk4poorcbc8dc2fc443
diff --git a/apps/desktop/src/app/chat/composer/fallback.test.tsx b/apps/desktop/src/app/chat/composer/fallback.test.tsx
index 0ccb752c0bf..0643b53769a 100644
--- a/apps/desktop/src/app/chat/composer/fallback.test.tsx
+++ b/apps/desktop/src/app/chat/composer/fallback.test.tsx
@@ -1,20 +1,15 @@
import { render } from '@testing-library/react'
import { describe, expect, it } from 'vitest'
-import { composerInputSurface } from '@/components/chat/composer-dock'
+import { composerInputBacking } from '@/components/chat/composer-dock'
import { ChatBarFallback } from './index'
-const hasBackdropFilter = (classes: string) =>
- classes.includes('backdrop-blur') || classes.includes('backdrop-saturate') || classes.includes('backdrop-filter')
-
describe('ChatBarFallback', () => {
- it('uses the same filter-free surface treatment as the hydrated composer', () => {
+ it('paints the shared composerInputBacking layer', () => {
const { container } = render(<ChatBarFallback />)
const paint = container.querySelector<HTMLElement>('[aria-hidden="true"]')
- expect(paint).not.toBeNull()
- expect(paint?.className).toContain(composerInputSurface)
- expect(hasBackdropFilter(paint?.className ?? '')).toBe(false)
+ expect(paint?.className).toBe(composerInputBacking)
})
})
diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx
index 053ee617b81..9d6cad82117 100644
--- a/apps/desktop/src/app/chat/composer/index.tsx
+++ b/apps/desktop/src/app/chat/composer/index.tsx
@@ -4,7 +4,7 @@ import { type ClipboardEvent, type FormEvent, type KeyboardEvent, useCallback, u
import { useTourMarker } from '@/app/chat/tour-marker'
import { useHudComposerDrag } from '@/app/hud/composer-drag'
-import { composerFloatingStrip, composerInputSurface } from '@/components/chat/composer-dock'
+import { composerFloatingStrip, composerInputBacking } from '@/components/chat/composer-dock'
import { $chatOnboardingSolo, $chatOnboardingThreadIds } from '@/components/onboarding-chat/assembly'
import { OnboardingSkip } from '@/components/onboarding-chat/skip'
import { OnboardingStart } from '@/components/onboarding-chat/start'
@@ -1149,6 +1149,7 @@ export function ChatBar({
// guard forever (#44135). Clear unconditionally: by the time blur
// runs there is nothing left composing in this editor.
composingRef.current = false
+
if (blurCloseTimer.current !== null) {
window.clearTimeout(blurCloseTimer.current)
}
@@ -1407,7 +1408,7 @@ export function ChatBar({
>
<div
aria-hidden
- className={cn('pointer-events-none absolute inset-0 -z-10 rounded-[inherit]', composerInputSurface)}
+ className={composerInputBacking}
/>
{!guidedChat && (
<CodingStatusRow
@@ -1528,7 +1529,7 @@ export function ChatBarFallback() {
<div className="composer-fallback-surface relative isolate h-(--composer-fallback-height) w-full rounded-[inherit] border border-[color-mix(in_srgb,var(--dt-composer-ring)_calc(18%*var(--composer-ring-strength)),var(--dt-input))]">
<div
aria-hidden
- className={cn('pointer-events-none absolute inset-0 -z-10 rounded-[inherit]', composerInputSurface)}
+ className={composerInputBacking}
/>
</div>
</div>
diff --git a/apps/desktop/src/components/chat/composer-dock.test.ts b/apps/desktop/src/components/chat/composer-dock.test.ts
index 6f9d44431a2..accb0dd1053 100644
--- a/apps/desktop/src/components/chat/composer-dock.test.ts
+++ b/apps/desktop/src/components/chat/composer-dock.test.ts
@@ -11,12 +11,9 @@ const hasBackdropFilter = (classes: string) =>
classes.includes('backdrop-blur') || classes.includes('backdrop-saturate') || classes.includes('backdrop-filter')
describe('composer surface treatments', () => {
- it('keeps the frequently repainting input surface free of backdrop filters', () => {
+ it('keeps the frequently repainting input surface free of backdrop filters, glass stays on the chrome', () => {
expect(composerInputSurface).toContain(composerFill)
expect(hasBackdropFilter(composerInputSurface)).toBe(false)
- })
-
- it('retains the glass treatment on non-input composer chrome', () => {
expect(hasBackdropFilter(composerDockCard())).toBe(true)
expect(hasBackdropFilter(composerPanelCard)).toBe(true)
})
diff --git a/apps/desktop/src/components/chat/composer-dock.ts b/apps/desktop/src/components/chat/composer-dock.ts
index 27684cc4ee0..2c1e6c8bb82 100644
--- a/apps/desktop/src/components/chat/composer-dock.ts
+++ b/apps/desktop/src/components/chat/composer-dock.ts
@@ -12,6 +12,8 @@ const composerFillTransition = 'transition-[background-color] duration-150 ease-
/** Paint for the frequently repainting editable surface. Keep backdrop filters
* off this hot path so typing does not re-blur the transcript each frame. */
export const composerInputSurface = cn(composerFill, composerFillTransition)
+// The `-z-10` paint layer behind the editable surface; hydrated and fallback composers share it.
+export const composerInputBacking = cn('pointer-events-none absolute inset-0 -z-10 rounded-[inherit]', composerInputSurface)
/** Backdrop treatment for non-input composer chrome. Harmless when the fill
* goes opaque (drawer open) — nothing shows through to blur. */
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 21208ec9d2f..7a023911755 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -3472,8 +3472,7 @@ button[data-slot='aui_msg-reactions'] svg {
}
/* The composer surface paints TWO layers: the surface itself, plus an
- `absolute inset-0 -z-10` fill+glass div behind it (composerFill /
- composerSurfaceGlass). Two stacked fills read as a box inside a box, so the
+ `absolute inset-0 -z-10` fill div behind it (composerInputBacking). Two stacked fills read as a box inside a box, so the
backing layer goes and the surface carries the single fill. */
[data-hud-shell] [data-slot='composer-surface'] > .pointer-events-none.absolute.inset-0 {
display: none !important;