@@ -443,6 +443,64 @@ describe("SessionList visible hydration", () => {
443443 expect ( link ?. getAttribute ( "href" ) ) . toBe ( "/sessions/native-session" ) ;
444444 } ) ;
445445
446+ it ( "keeps keyboard-style anchor activation on the SPA session path" , async ( ) => {
447+ const selectSession = vi
448+ . spyOn ( sessions , "selectSession" )
449+ . mockImplementation ( ( ) => { } ) ;
450+ sessions . sessions = [
451+ makeSession ( {
452+ id : "keyboard-session" ,
453+ display_name : "Keyboard target" ,
454+ is_index_only : false ,
455+ } ) ,
456+ ] ;
457+ vi . spyOn ( sessions , "hydrateVisibleSessions" ) . mockResolvedValue (
458+ undefined ,
459+ ) ;
460+
461+ component = mount ( SessionList , { target : document . body } ) ;
462+ await tick ( ) ;
463+
464+ const link = document . querySelector < HTMLAnchorElement > (
465+ ".session-info-link" ,
466+ ) ;
467+ expect ( link ) . not . toBeNull ( ) ;
468+ const click = new MouseEvent ( "click" , {
469+ bubbles : true ,
470+ cancelable : true ,
471+ detail : 0 ,
472+ } ) ;
473+ link ! . dispatchEvent ( click ) ;
474+
475+ expect ( click . defaultPrevented ) . toBe ( true ) ;
476+ expect ( selectSession ) . toHaveBeenCalledWith ( "keyboard-session" ) ;
477+ } ) ;
478+
479+ it ( "keeps the non-link parts of the row selectable" , async ( ) => {
480+ const selectSession = vi
481+ . spyOn ( sessions , "selectSession" )
482+ . mockImplementation ( ( ) => { } ) ;
483+ sessions . sessions = [
484+ makeSession ( {
485+ id : "row-session" ,
486+ display_name : "Row target" ,
487+ is_index_only : false ,
488+ } ) ,
489+ ] ;
490+ vi . spyOn ( sessions , "hydrateVisibleSessions" ) . mockResolvedValue (
491+ undefined ,
492+ ) ;
493+
494+ component = mount ( SessionList , { target : document . body } ) ;
495+ await tick ( ) ;
496+
497+ const sideMeta = document . querySelector < HTMLElement > ( ".side-meta" ) ;
498+ expect ( sideMeta ) . not . toBeNull ( ) ;
499+ sideMeta ! . click ( ) ;
500+
501+ expect ( selectSession ) . toHaveBeenCalledWith ( "row-session" ) ;
502+ } ) ;
503+
446504 it ( "opens the same canonical href from the context menu in a new tab" , async ( ) => {
447505 const openSpy = vi
448506 . spyOn ( window , "open" )
0 commit comments