The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep turn-activity live region mounted across idle gaps (#46225)
kshitijk4poor66b31fc781f3
diff --git a/apps/desktop/src/components/assistant-ui/thread/status.test.tsx b/apps/desktop/src/components/assistant-ui/thread/status.test.tsxindex debf7146c07..e4311b78871 100644--- a/apps/desktop/src/components/assistant-ui/thread/status.test.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/status.test.tsx@@ -70,6 +70,7 @@ 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())diff --git a/apps/desktop/src/components/assistant-ui/thread/status.tsx b/apps/desktop/src/components/assistant-ui/thread/status.tsxindex 7f200d390ca..d959a9e1f7c 100644--- a/apps/desktop/src/components/assistant-ui/thread/status.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/status.tsx@@ -358,23 +358,44 @@ export const TurnActivityIndicator: FC = () => {compacting ? turnStartedAt : (quietSince ?? drafting?.since ?? turnStartedAt))- if (!active) {+ // Once the row has been shown, keep its live region mounted across+ // quiet/working flips: remounting a role="status" node makes screen readers+ // re-announce it on every gap (#46225). While idle it is visually hidden+ // (sr-only, not display:none, so it stays in the accessibility tree) and+ // empty and unlabelled — the pulse and timer only mount while active, so an idle window+ // holds no pulse beat.+ const [everActive, setEverActive] = useState(false)++ if (active && !everActive) {+ setEverActive(true)+ }++ if (!active && !everActive) {return null}return (- <StatusRow data-slot="aui_turn-activity" label={hint || 'Hermes is working'}>- <StatusPulse- aria-hidden="true"- className="dither inline-block size-3 rounded-[2px] text-midground/80"- kind="opacity"- />- {hint ? (- <WaitHint hint={hint} />- ) : localLoad ? (- <ProgressHint label={t.assistant.thread.loadingLocalModel(localLoad.model)} percent={localLoad.percent} />- ) : null}- <ActivityTimerText aria-hidden={true} seconds={elapsed} />+ <StatusRow+ className={cn(!active && 'sr-only')}+ data-slot="aui_turn-activity"+ data-state={active ? 'active' : 'idle'}+ label={active ? hint || 'Hermes is working' : ''}+ >+ {active && (+ <>+ <StatusPulse+ aria-hidden="true"+ className="dither inline-block size-3 rounded-[2px] text-midground/80"+ kind="opacity"+ />+ {hint ? (+ <WaitHint hint={hint} />+ ) : localLoad ? (+ <ProgressHint label={t.assistant.thread.loadingLocalModel(localLoad.model)} percent={localLoad.percent} />+ ) : null}+ <ActivityTimerText aria-hidden={true} seconds={elapsed} />+ </>+ )}</StatusRow>)}diff --git a/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsx b/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsxindex 8554e7525ff..419b3beb2f6 100644--- a/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsx@@ -116,4 +116,35 @@ describe('the turn timer covers the gaps, not just the streaming', () => {expect(container.querySelector('[data-slot="aui_turn-activity"]')).toBeNull()})++ it('keeps one live region across working/idle flips so screen readers do not re-announce it', () => {+ const { container } = render(+ <Harness+ messages={[userMessage('u1', 'do the thing'), assistant('a1', [{ type: 'text', text: 'On it.' }], false)]}+ />+ )++ act(() => vi.advanceTimersByTime(7_000))+ const row = container.querySelector<HTMLElement>('[data-slot="aui_turn-activity"]')+ expect(row?.dataset.state).toBe('active')+ // The ticking timer must not feed the live region.+ const hidden = [...(row?.querySelectorAll('[aria-hidden="true"]') ?? [])].map(n => n.textContent)+ expect(hidden.some(text => /\d+s/.test(text ?? ''))).toBe(true)++ act(() => $busy.set(false))+ // Idle: same node, still an exposed live region — visually hidden via+ // sr-only, never display:none / [hidden], which would drop it from the+ // accessibility tree and re-announce on the next flip.+ expect(container.querySelector('[data-slot="aui_turn-activity"]')).toBe(row)+ expect(row?.dataset.state).toBe('idle')+ expect(row?.hidden).toBe(false)+ expect(row?.classList.contains('hidden')).toBe(false)+ expect(row?.getAttribute('aria-live')).toBe('polite')+ expect(row?.textContent).toBe('')+ expect(row?.getAttribute('aria-label')).toBeFalsy()++ act(() => $busy.set(true))+ act(() => vi.advanceTimersByTime(7_000))+ expect(container.querySelector('[data-slot="aui_turn-activity"][data-state="active"]')).toBe(row)+ })})