Skip to content

Commit 381a2ed

Browse files
committed
Fix scrolling to element anchor in URL
1 parent f99055d commit 381a2ed

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/components/syntaxes/SyntaxDisplayManager.astro

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,14 @@ export interface VersionFilterData {
479479
} else {
480480
noResultsElement.style.display = 'none';
481481
}
482-
window.scrollTo({
483-
top: 0,
484-
behavior: 'smooth',
485-
})
482+
if (window.location.hash) {
483+
scrollTo(window.location.hash.substring(1))
484+
} else {
485+
window.scrollTo({
486+
top: 0,
487+
behavior: 'smooth',
488+
})
489+
}
486490
}
487491

488492
// Use RAF for smooth scrolling - claude addition

0 commit comments

Comments
 (0)