@@ -48,12 +48,12 @@ const HEADER_GAP = 8;
4848const ITEM_HEIGHT = 28 ;
4949
5050export const DeclarationsSidebar = ( { onNavigate } : { onNavigate ?: ( ) => void } ) => {
51- const { declarations } = useContext ( DeclarationsContext ) ;
51+ const { declarations, game } = useContext ( DeclarationsContext ) ;
5252 const { filter, setFilter } = useContext ( SidebarFilterContext ) ;
5353 const { module : activeModule = "" , scope = "" } = useParams ( ) ;
5454 const [ collapsed , setCollapsed ] = useState < Set < string > > ( ( ) => new Set ( ) ) ;
5555 const [ hydrated , setHydrated ] = useState ( false ) ;
56- const parentRef = useRef < HTMLDivElement > ( null ) ;
56+ const parentRef = useRef < HTMLUListElement > ( null ) ;
5757 const wrapperRef = useRef < HTMLDivElement > ( null ) ;
5858 const activeStickyIndexRef = useRef ( 0 ) ;
5959 const navigatedFromSidebarRef = useRef ( false ) ;
@@ -212,10 +212,8 @@ export const DeclarationsSidebar = ({ onNavigate }: { onNavigate?: () => void })
212212 onNavigate ?.( ) ;
213213 } , [ onNavigate ] ) ;
214214
215- const { game } = useContext ( DeclarationsContext ) ;
216-
217215 return (
218- < SidebarWrapper ref = { wrapperRef } >
216+ < SidebarWrapper ref = { wrapperRef } aria-label = "Classes and enums" >
219217 < SidebarHeader >
220218 < SidebarBrandRow >
221219 < SidebarBrand href = "https://s2v.app/" >
@@ -236,15 +234,15 @@ export const DeclarationsSidebar = ({ onNavigate }: { onNavigate?: () => void })
236234 />
237235 </ SidebarHeader >
238236 { hydrated ? (
239- < div ref = { parentRef } style = { { flex : 1 , overflow : "auto" } } >
237+ < SidebarList ref = { parentRef } >
240238 < div style = { { height : virtualizer . getTotalSize ( ) , position : "relative" } } >
241239 { virtualizer . getVirtualItems ( ) . map ( ( virtualRow ) => {
242240 const row = rows [ virtualRow . index ] ;
243241 const isHeader = row . type === "header" ;
244242 const isActiveSticky = activeStickyIndexRef . current === virtualRow . index ;
245243
246244 return (
247- < div
245+ < li
248246 key = { virtualRow . key }
249247 style = { {
250248 ...( isActiveSticky
@@ -276,17 +274,17 @@ export const DeclarationsSidebar = ({ onNavigate }: { onNavigate?: () => void })
276274 onClick = { handleSidebarNavigate }
277275 />
278276 ) }
279- </ div >
277+ </ li >
280278 ) ;
281279 } ) }
282280 </ div >
283- </ div >
281+ </ SidebarList >
284282 ) : (
285- < div style = { { flex : 1 , overflow : "auto" } } >
283+ < SidebarList >
286284 { staticRows . map ( ( row , i ) => {
287285 if ( row . type === "header" ) {
288286 return (
289- < div
287+ < li
290288 key = { `h-${ row . module } ` }
291289 style = { {
292290 height : HEADER_HEIGHT + ( i > 0 ? HEADER_GAP : 0 ) ,
@@ -296,17 +294,16 @@ export const DeclarationsSidebar = ({ onNavigate }: { onNavigate?: () => void })
296294 < SidebarGroupHeader >
297295 { row . module } ({ row . count } )
298296 </ SidebarGroupHeader >
299- </ div >
297+ </ li >
300298 ) ;
301299 }
302300 return (
303- < DeclarationSidebarElement
304- key = { `${ row . declaration . module } -${ row . declaration . name } ` }
305- declaration = { row . declaration }
306- />
301+ < li key = { `${ row . declaration . module } -${ row . declaration . name } ` } >
302+ < DeclarationSidebarElement declaration = { row . declaration } />
303+ </ li >
307304 ) ;
308305 } ) }
309- </ div >
306+ </ SidebarList >
310307 ) }
311308 </ SidebarWrapper >
312309 ) ;
@@ -340,3 +337,11 @@ const SidebarBrand = styled.a`
340337const SidebarSearchInput = styled ( SearchInput ) `
341338 background: var(--background);
342339` ;
340+
341+ const SidebarList = styled . ul `
342+ flex: 1;
343+ overflow: auto;
344+ margin: 0;
345+ padding: 0;
346+ list-style: none;
347+ ` ;
0 commit comments