@@ -63,7 +63,7 @@ function scrollSidebarItemIntoView() {
6363
6464// handles automatic scrolling of the API reference sidebar (openapi-docs)
6565function scrollOpenApiSidebarItemIntoView ( ) {
66- const $li = document . querySelector ( `li > a.menu__link--active[href]` ) ;
66+ const $li = document . querySelector ( `ul.theme-doc-sidebar-menu a.menu__link--active[href]` ) ;
6767
6868 if ( ! $li ) {
6969 return ;
@@ -83,21 +83,16 @@ function redirectOpenApiDocs() {
8383 return ;
8484 }
8585
86- if ( hash . startsWith ( '#/reference/' ) ) {
87- const sidebarItems = document . querySelectorAll ( '[data-altids]' ) ;
86+ const sidebarItems = document . querySelectorAll ( '[data-altids]' ) ;
8887
88+ if ( hash . startsWith ( '#/reference/' ) || hash . startsWith ( '#tag/' ) ) {
8989 for ( const item of sidebarItems ) {
9090 const ids = item . getAttribute ( 'data-altids' ) . split ( ',' ) ;
9191 if ( ids . find ( ( variant ) => variant === hash ) ) {
9292 item . click ( ) ;
9393 }
9494 }
9595 }
96-
97- if ( hash . startsWith ( '#tag/' ) ) {
98- const id = hash . substring ( '#tag/' . length ) ;
99- console . log ( 'redirect' , { id, hash } ) ;
100- }
10196}
10297
10398let ticking = false ;
@@ -121,7 +116,7 @@ window.addEventListener('load', () => {
121116 setTimeout ( ( ) => scrollSidebarItemIntoView ( ) , 1000 ) ;
122117
123118 // docusaurus-openapi-docs plugin: scroll sidebar into viewport, no need for a large timeout here
124- setTimeout ( ( ) => scrollOpenApiSidebarItemIntoView ( ) , 100 ) ;
119+ setTimeout ( ( ) => scrollOpenApiSidebarItemIntoView ( ) , 200 ) ;
125120} ) ;
126121
127122window . addEventListener ( 'popstate' , ( ) => {
0 commit comments