Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Elastic.Markdown/Assets/pages-nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ export function initNav() {

const pagesDropdown = $('#pages-dropdown')
if (pagesDropdown) {
const activeAnchor = $('a.pages-dropdown_active', pagesDropdown)
activeAnchor?.addEventListener('mousedown', (e) => {
e.preventDefault()
const anchors = $$('a', pagesDropdown)
anchors.forEach((a) => {
a.addEventListener('mousedown', (e) => {
e.preventDefault()
})
a.addEventListener('mouseup', () => {
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur()
}
})
})
}

const allNavItems = $$('a', pagesNav)
allNavItems.forEach((link) => {
link.addEventListener('click', () => {
link.closest('details').removeAttribute('open')
})
})

const navItems = $$(
'a[href="' +
window.location.pathname +
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Markdown/Slices/Layout/_TocTree.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@if (Model.IsPrimaryNavEnabled && current is { Group.Index: not null })
{
<div class="sticky top-0 py-6 bg-white z-10 border-b-1 border-grey-20 pr-4">
<div id="pages-dropdown" class="block group border-1 border-grey-20 rounded-sm font-sans relative">
<div tabindex="0" id="pages-dropdown" class="block group border-1 border-grey-20 rounded-sm font-sans relative">
<button class="w-full text-left 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">
<div>
<a
Expand Down
Loading