File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -289,12 +289,16 @@ export async function loadAnchorContent(anchorId) {
289289 details . setAttribute ( 'open' , '' )
290290 } )
291291
292- // Convert internal AsciiDoc cross-reference links to router navigation
293- contentEl . querySelectorAll ( 'a[href^="#"]' ) . forEach ( ( link ) => {
292+ // Convert internal AsciiDoc cross-reference links to router navigation.
293+ // Exclude sub-anchor links (handled above) — they share the href="#" shape
294+ // and would otherwise also fire navigate('/anchor/') with an empty id,
295+ // which the router treats as a non-anchor route and closes the modal.
296+ contentEl . querySelectorAll ( 'a[href^="#"]:not([data-sub-anchor])' ) . forEach ( ( link ) => {
294297 const href = link . getAttribute ( 'href' )
295- // Only process simple hash links ( cross-references) , not hash routes
298+ // Only process real cross-references: a non-empty id , not a hash route.
296299 if ( href && href . startsWith ( '#' ) && ! href . startsWith ( '#/' ) ) {
297300 const anchorId = href . substring ( 1 ) // Remove the '#'
301+ if ( ! anchorId ) return
298302 link . addEventListener ( 'click' , ( e ) => {
299303 e . preventDefault ( )
300304 // Navigate to the linked anchor
You can’t perform that action at this time.
0 commit comments