@@ -15,19 +15,19 @@ const tocTree = buildTocTree(items)
1515{
1616 tocTree .length > 0 && (
1717 <>
18- <table-of-contents class = " block" >
19- { /* Edge trigger: partial circle on right edge, visible when drawer is closed */ }
18+ <table-of-contents class = " block group/toc " >
19+ { /* Open button, partial circle on right edge and visible when drawer is closed */ }
2020 <button
2121 type = " button"
2222 data-toc-toggle
2323 aria-controls = " toc-drawer"
2424 aria-label = " Open table of contents"
25- class = " fixed right-0 top-1/2 -translate-y-1/2 z-(--z-content-floating) flex h-16 w-9 items-center justify-center rounded-l-full border border-r-0 border-trim bg-page-base transition-opacity hover:shadow-lg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary md:hidden"
25+ class = " fixed - right-2 top-1/2 -translate-y-1/2 z-(--z-content-floating) flex h-16 w-9 items-center justify-center rounded-l-full border border-r-0 border-content bg-page-base transition-opacity duration-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary md:hidden group-data-open/toc:opacity-0 group-data-open/toc:pointer-events-none "
2626 >
27- <Icon icon = " arrow-left" size = { 6 } />
27+ <Icon icon = " arrow-left" size = { 6 } color = " content " />
2828 </button >
2929
30- { /* Full-screen scrim overlay */ }
30+ { /* Full-screen scrim overlay with background blur when drawer is open */ }
3131 <button
3232 type = " button"
3333 data-toc-overlay
@@ -41,22 +41,36 @@ const tocTree = buildTocTree(items)
4141 id = " toc-drawer"
4242 data-toc-panel
4343 data-state = " closed"
44- class = " fixed top-0 right-0 bottom-0 z-(--z-content-floating) w-[80vw] translate-x-full overflow-y-auto bg-page-base shadow-[-20px_0_60px_rgba(15,23,42,0.35)] transition-transform duration-300 ease-out data-[state=open]:translate-x-0 lg:static lg:z-auto lg:w-auto lg:translate-x-0 lg:overflow-y-visible lg:bg-transparent lg:shadow-none lg:h-full"
44+ class = " group/drawer fixed top-0 right-0 bottom-0 z-(--z-content-floating) w-[80vw] translate-x-full overflow-visible bg-page-base transition-transform duration-300 ease-out data-[state=open]:translate-x-0 lg:static lg:z-auto lg:w-auto lg:translate-x-0 lg:overflow-y-visible lg:overflow-x-visible lg:bg-transparent lg:h-full"
4545 >
46- { /* Close button header — mobile only */ }
47- <div class = " flex items-center justify-between gap-3 px-5 pt-5 lg:hidden" >
48- <h2 class = " text-base font-semibold" >Table of Contents</h2 >
49- <button
50- type = " button"
51- data-toc-close
52- aria-label = " Close table of contents"
53- class = " flex h-10 w-10 items-center justify-center rounded-full transition-colors hover:bg-surface focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
54- >
55- <Icon icon = " arrow-right" size = { 18 } />
56- </button >
57- </div >
46+ { /* Left border segments — split around the close button circle */ }
47+ <div class = " absolute left-0 top-0 w-px bg-content lg:hidden" style = " height: calc(50% - 2rem);" ></div >
48+ <div class = " absolute left-0 bottom-0 w-px bg-content lg:hidden" style = " height: calc(50% - 2rem);" ></div >
5849
59- <aside
50+ { /* Close button — vertically centered on the drawer's left edge.
51+ The icon starts as arrow-left and rotates 180° to arrow-right
52+ as the drawer slides open. Only the left semicircle has a border. */ }
53+ <button
54+ type = " button"
55+ data-toc-close
56+ aria-controls = " toc-drawer"
57+ aria-label = " Close table of contents"
58+ class = " absolute -left-6 top-1/2 -translate-y-1/2 z-(--z-content-floating) flex h-16 w-9 items-center justify-center rounded-l-full border border-r-0 border-content bg-page-base opacity-0 pointer-events-none transition-opacity duration-300 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary lg:hidden group-data-[state=open]/drawer:opacity-100 group-data-[state=open]/drawer:pointer-events-auto"
59+ style = " clip-path: inset(0 0.75rem 0 0);"
60+ >
61+ <span class = " inline-flex transition-transform duration-300 group-data-[state=open]/drawer:rotate-180" >
62+ <Icon icon = " arrow-left" size = { 6 } color = " content" />
63+ </span >
64+ </button >
65+
66+ { /* Scrollable inner wrapper (overflow moved here from outer panel) */ }
67+ <div class = " h-full overflow-y-auto" >
68+ { /* Drawer heading — mobile only */ }
69+ <div class = " flex items-center gap-3 px-5 pt-5 lg:hidden" >
70+ <h2 class = " text-base font-semibold" >Table of Contents</h2 >
71+ </div >
72+
73+ <aside
6074 class = " px-5 py-6 lg:sticky lg:rounded-lg lg:border lg:border-trim lg:bg-page-base lg:shadow-none"
6175 style = " top: 1rem;"
6276 aria-labelledby = " toc-heading"
@@ -98,6 +112,7 @@ const tocTree = buildTocTree(items)
98112 </ol >
99113 </nav >
100114 </aside >
115+ </div >{ /* end scrollable inner wrapper */ }
101116 </div >
102117 </table-of-contents >
103118
0 commit comments