File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 import type { HeaderSearchResult } from " carbon-components-svelte/src/UIShell/HeaderSearch.svelte" ;
2121 import LogoGithub from " carbon-icons-svelte/lib/LogoGithub.svelte" ;
2222 import MiniSearch from " minisearch" ;
23- import { onDestroy } from " svelte" ;
23+ import { onMount , tick } from " svelte" ;
2424 import SEARCH_INDEX from " ../SEARCH_INDEX.json" ;
2525 import { theme } from " ../store" ;
2626
4747 const unsubGoto = goto .subscribe ((fn ) => {
4848 navigateTo = fn ;
4949 });
50- onDestroy (unsubGoto );
50+
51+ onMount (() => {
52+ tick ().then (() => {
53+ const selected = document .querySelector (
54+ ' .bx--side-nav [aria-current="page"]' ,
55+ );
56+ selected ?.scrollIntoView ({ block: " center" });
57+ });
58+
59+ return () => {
60+ unsubGoto ();
61+ };
62+ });
5163
5264 const deprecated: string [] = [];
5365 const new_components: string [] = [];
You can’t perform that action at this time.
0 commit comments