The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): silence live-region elapsed timers
Kevin Yinc14933bf455a
diff --git a/apps/desktop/src/app/chat/composer/voice-activity.test.tsx b/apps/desktop/src/app/chat/composer/voice-activity.test.tsxnew file mode 100644index 00000000000..1bb401e8eb3--- /dev/null+++ b/apps/desktop/src/app/chat/composer/voice-activity.test.tsx@@ -0,0 +1,26 @@+import { cleanup, render, screen } from '@testing-library/react'+import { afterEach, describe, expect, it } from 'vitest'++import { I18nProvider } from '@/i18n'++import { VoiceActivity } from './voice-activity'++afterEach(cleanup)++describe('VoiceActivity accessibility', () => {+ it('keeps the dictation timer visible without announcing every tick', () => {+ render(+ <I18nProvider configClient={null} initialLocale="en">+ <VoiceActivity state={{ elapsedSeconds: 65, level: 0.5, status: 'recording' }} />+ </I18nProvider>+ )++ const status = screen.getByRole('status')+ const timer = screen.getByText('1:05')++ expect(status.getAttribute('aria-live')).toBe('polite')+ expect(status.textContent).toContain('Dictating')+ expect(status.textContent).toContain('1:05')+ expect(timer.getAttribute('aria-hidden')).toBe('true')+ })+})diff --git a/apps/desktop/src/app/chat/composer/voice-activity.tsx b/apps/desktop/src/app/chat/composer/voice-activity.tsxindex bd1f3303621..e694229f5b9 100644--- a/apps/desktop/src/app/chat/composer/voice-activity.tsx+++ b/apps/desktop/src/app/chat/composer/voice-activity.tsx@@ -193,7 +193,7 @@ export function VoiceActivity({ state }: { state: VoiceActivityState }) {<div className="flex min-w-0 flex-1 items-center gap-2"><span className="truncate font-medium text-foreground/85">{title}</span>- <span className="font-mono text-[0.6875rem] text-muted-foreground/85">+ <span aria-hidden="true" className="font-mono text-[0.6875rem] text-muted-foreground/85">{formatElapsed(state.elapsedSeconds)}</span></div>diff --git a/apps/desktop/src/components/assistant-ui/thread/status.test.tsx b/apps/desktop/src/components/assistant-ui/thread/status.test.tsxindex a9f0d59440c..debf7146c07 100644--- a/apps/desktop/src/components/assistant-ui/thread/status.test.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/status.test.tsx@@ -70,4 +70,17 @@ describe('ResponseLoadingIndicator timer', () => {expect(screen.getByText('⏳ waiting on local-model — 30s with no output yet')).toBeTruthy()})+ it('keeps the ticking timer out of the live region accessibility tree', () => {+ $activeSessionId.set('session-a')+ $turnStartedAt.set(Date.now())+ renderIndicator()++ act(() => vi.advanceTimersByTime(2_000))++ const status = screen.getByRole('status')+ const timer = [...status.querySelectorAll('[aria-hidden="true"]')].find(el => el.textContent === '2s')++ expect(status.getAttribute('aria-live')).toBe('polite')+ expect(timer).toBeDefined()+ })})diff --git a/apps/desktop/src/components/assistant-ui/thread/status.tsx b/apps/desktop/src/components/assistant-ui/thread/status.tsxindex 9f7fd9b2490..7f200d390ca 100644--- a/apps/desktop/src/components/assistant-ui/thread/status.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/status.tsx@@ -262,7 +262,7 @@ export const ResponseLoadingIndicator: FC = () => {) : localLoad ? (<ProgressHint label={t.assistant.thread.loadingLocalModel(localLoad.model)} percent={localLoad.percent} />) : null}- <ActivityTimerText seconds={elapsed} />+ <ActivityTimerText aria-hidden={true} seconds={elapsed} /></StatusRow>)}@@ -374,7 +374,7 @@ export const TurnActivityIndicator: FC = () => {) : localLoad ? (<ProgressHint label={t.assistant.thread.loadingLocalModel(localLoad.model)} percent={localLoad.percent} />) : null}- <ActivityTimerText seconds={elapsed} />+ <ActivityTimerText aria-hidden={true} seconds={elapsed} /></StatusRow>)}diff --git a/apps/desktop/src/components/chat/activity-timer-text.tsx b/apps/desktop/src/components/chat/activity-timer-text.tsxindex d9ca1c292e2..7f0123d0aad 100644--- a/apps/desktop/src/components/chat/activity-timer-text.tsx+++ b/apps/desktop/src/components/chat/activity-timer-text.tsx@@ -4,13 +4,15 @@ import { formatElapsed } from './activity-timer'import { StableText } from './stable-text'interface ActivityTimerTextProps {+ 'aria-hidden'?: booleanseconds: numberclassName?: string}-export function ActivityTimerText({ seconds, className }: ActivityTimerTextProps) {+export function ActivityTimerText({ 'aria-hidden': ariaHidden, seconds, className }: ActivityTimerTextProps) {return (<StableText+ aria-hidden={ariaHidden}className={cn(// Tinted with --dt-midground (very low alpha) so the timer reads// as part of the same "live signal" cluster as the dither block /diff --git a/apps/desktop/src/components/chat/stable-text.tsx b/apps/desktop/src/components/chat/stable-text.tsxindex 1e7e03815cd..c4d07997901 100644--- a/apps/desktop/src/components/chat/stable-text.tsx+++ b/apps/desktop/src/components/chat/stable-text.tsx@@ -1,6 +1,7 @@import { cn } from '@/lib/utils'interface StableTextProps {+ 'aria-hidden'?: booleanchildren: stringclassName?: string}@@ -10,9 +11,9 @@ interface StableTextProps {* shift the layout as they change (e.g. digits in a ticking timer).* Works with any proportional font — no need for font-mono.*/-export function StableText({ children, className }: StableTextProps) {+export function StableText({ 'aria-hidden': ariaHidden, children, className }: StableTextProps) {return (- <span className={cn('inline-flex', className)}>+ <span aria-hidden={ariaHidden} className={cn('inline-flex', className)}>{children.split('').map((char, i) => (<span className="inline-block w-[1ch] text-center" key={i}>{char}