Skip to content

Commit cc2699e

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(ui): announce code search result changes
1 parent bb028dd commit cc2699e

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/components/code-search-overlay/code-search-overlay.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ describe('CodeSearchOverlay', () => {
6767
expect(input.getAttribute('aria-label')).toBe('Search code')
6868
expect(input.value).toBe('error')
6969
expect(overlay.textContent).toContain('2/3')
70+
const tally = overlay.querySelector('[aria-live="polite"][aria-atomic="true"]')
71+
expect(tally?.textContent).toBe('2/3')
7072

7173
const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set
7274
act(() => {
@@ -83,6 +85,9 @@ describe('CodeSearchOverlay', () => {
8385
expect(callbacks.onNext).toHaveBeenCalledTimes(1)
8486
expect(callbacks.onClose).toHaveBeenCalledTimes(1)
8587
expect(parentClick).not.toHaveBeenCalled()
88+
89+
renderOverlay({ matchCount: 0, currentMatchIndex: 0 })
90+
expect(tally?.textContent).toBe('0/0')
8691
})
8792

8893
it('keeps preview search compact in a floating overlay with a usable input ref', () => {

‎apps/sim/app/workspace/[workspaceId]/components/code-search-overlay/code-search-overlay.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export function CodeSearchOverlay({
6868
<ChipInput {...inputProps} appearance='compactSearch' className='mr-0.5 w-[94px]' />
6969
)}
7070
<span
71+
aria-live='polite'
72+
aria-atomic='true'
7173
className={cn(
7274
attached ? 'w-[58px] text-xs' : 'min-w-[45px] text-center text-xs',
7375
matchCount > 0 ? 'text-[var(--text-secondary)]' : 'text-[var(--text-tertiary)]'

0 commit comments

Comments
 (0)