Skip to content

Commit 634cb43

Browse files
jsell-rhclaude
andcommitted
fix(ambient-ui): fix nested interactive element in tab strip (a11y)
Replace <button role="tab"> containing <span role="button"> with <div role="tab" tabIndex={0}> containing a proper <button> for the close action. Fixes ARIA authoring practices violation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bdacbb7 commit 634cb43

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

components/ambient-ui/src/components/chat-sidebar.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,30 @@ function TabStrip({
8282
{sessions.map(s => {
8383
const isActive = s.sessionId === activeId
8484
return (
85-
<button
85+
<div
8686
key={s.sessionId}
87-
type="button"
8887
role="tab"
88+
tabIndex={0}
8989
aria-selected={isActive}
90-
className={`group flex items-center gap-1.5 px-2.5 py-1 text-xs min-w-0 flex-1 truncate transition-colors ${
90+
className={`group flex items-center gap-1.5 px-2.5 py-1 text-xs min-w-0 flex-1 truncate transition-colors cursor-pointer ${
9191
isActive
9292
? 'border-b-2 border-primary text-foreground'
9393
: 'text-muted-foreground hover:text-foreground hover:bg-muted/50'
9494
}`}
9595
onClick={() => onSwitch(s.sessionId)}
96+
onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onSwitch(s.sessionId) } }}
9697
>
9798
<PhaseDot phase={getPhase(s.sessionId)} />
9899
<span className="truncate">{s.sessionName ?? s.agentName ?? s.sessionId.slice(0, 8)}</span>
99-
<span
100-
role="button"
101-
tabIndex={0}
100+
<button
101+
type="button"
102102
className="ml-auto shrink-0 opacity-0 group-hover:opacity-100 hover:text-destructive transition-opacity"
103103
onClick={e => { e.stopPropagation(); onClose(s.sessionId) }}
104-
onKeyDown={e => { if (e.key === 'Enter') { e.stopPropagation(); onClose(s.sessionId) } }}
105104
aria-label="Close tab"
106105
>
107106
<X className="h-3 w-3" />
108-
</span>
109-
</button>
107+
</button>
108+
</div>
110109
)
111110
})}
112111
{projectId && <NewSessionButton projectId={projectId} />}

0 commit comments

Comments
 (0)