File tree Expand file tree Collapse file tree
webview-ui/src/components/chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -310,16 +310,21 @@ export const ChangeCard = ({ message }: { message: ClineMessage }) => {
310310 </ span >
311311 < span className = "grow" />
312312 { diffBadges ( file . additions , file . deletions ) }
313- < span
314- className = "codicon codicon-link-external cursor-pointer"
315- style = { { fontSize : 13.5 } }
316- role = "button "
317- tabIndex = { 0 }
313+ { /* Native button (not a span) so keyboard users can open the
314+ file from a compact row: Enter/Space activate it for free. */ }
315+ < Button
316+ variant = "ghost "
317+ size = "icon"
318318 aria-label = { t ( "chat:changeCard.openFile" ) }
319319 title = { t ( "chat:changeCard.openFile" ) }
320320 data-testid = { `change-card-file-open-${ index } ` }
321- onClick = { ( ) => openFileInEditor ( file . path ) }
322- />
321+ onClick = { ( ) => openFileInEditor ( file . path ) } >
322+ < span
323+ className = "codicon codicon-link-external"
324+ style = { { fontSize : 13.5 } }
325+ aria-hidden
326+ />
327+ </ Button >
323328 </ div >
324329 ) }
325330 </ div >
Original file line number Diff line number Diff line change @@ -365,6 +365,27 @@ describe("ChangeCard", () => {
365365 fireEvent . click ( screen . getByTestId ( "change-card-file-open-0" ) )
366366 expect ( mockPostMessage ) . toHaveBeenCalledWith ( { type : "openFile" , text : "./src/c.ts" } )
367367 } )
368+
369+ it ( "renders the no-diff row open control as a native button so keyboard users can activate it" , ( ) => {
370+ renderWithExtensionState (
371+ < ChangeCard
372+ message = { makeCardMessage ( {
373+ detail : "summary" ,
374+ files : [ { path : "src/b.ts" , additions : 1 , deletions : 1 } ] ,
375+ totalFiles : 1 ,
376+ } ) }
377+ /> ,
378+ )
379+
380+ // A native <button> gets Enter/Space activation from platform semantics;
381+ // the previous span role=button had no keydown handler, so keyboard users
382+ // could not open the file from a compact row. (jsdom does not implement
383+ // button activation behavior, so the accessibility contract is asserted on
384+ // the element itself; the mouse path is covered by the click tests above.)
385+ const control = screen . getByTestId ( "change-card-file-open-0" )
386+ expect ( control . tagName ) . toBe ( "BUTTON" )
387+ expect ( control ) . toHaveAttribute ( "aria-label" , "Open file" )
388+ } )
368389} )
369390
370391describe ( "ChatRow - change_card say" , ( ) => {
You can’t perform that action at this time.
0 commit comments