Skip to content

Commit 4d97d9e

Browse files
authored
Ensure pages switcher is closed (#837)
1 parent c0e7204 commit 4d97d9e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Elastic.Markdown/Slices/Layout/_TocTree.cshtml

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
@if (Model.IsPrimaryNavEnabled && current is { Group.Index: not null })
88
{
99
<div class="sticky top-0 py-6 bg-white z-10 border-b-1 border-grey-20 pr-4">
10-
<details class="block group border-1 border-grey-20 rounded-sm font-sans ">
10+
<details class="block group border-1 border-grey-20 rounded-sm font-sans">
1111
<summary class="grid grid-cols-[1fr_auto] cursor-pointer font-semibold gap-1 hover:text-black pl-4 pr-2 py-2 group-open:border-b-1 border-grey-20">
1212
<span>
1313
<a
1414
class="hover:underline text-blue-elastic hover:text-blue-elastic-100"
1515
href="@current.Group.Index?.Url"
16-
@Htmx.GetHxAttributes(current.Group.Index?.Url!)
16+
@Htmx.GetHxAttributes(current.Group.Index?.Url!, true)
1717
>
1818
@current.Group.Index?.NavigationTitle
1919
</a>
@@ -37,6 +37,7 @@
3737
if (item.Id == current?.Id) continue;
3838
<li class="block">
3939
<a
40+
onclick="this.closest('details').removeAttribute('open')"
4041
class="block py-2 px-4 hover:underline hover:text-black hover:bg-grey-10 active:bg-blue-elastic-70 active:text-white font-semibold @(item.Group.Id == Model.Tree.Id ? "text-blue-elastic" : "")"
4142
href="@item.Group.Index.Url"
4243
@Htmx.GetHxAttributes(item.Group.Index.Url, false, "mouseover")>

0 commit comments

Comments
 (0)