Skip to content

Commit

Permalink
Revert to swup on list
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 25, 2025
1 parent 2b8fe60 commit 0916d53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions assets/js/sidebar/sidebar-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if (!isEmbedded) {
sessionStorage.setItem(SIDEBAR_WIDTH_KEY, width)
document.body.style.setProperty('--sidebarWidth', `${width}px`)
})

// We observe on mousedown because we only care about user resize.
sidebar.addEventListener('mousedown', () => resizeObserver.observe(sidebar))
sidebar.addEventListener('mouseup', () => resizeObserver.unobserve(sidebar))
Expand Down
6 changes: 5 additions & 1 deletion assets/js/sidebar/sidebar-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ export function initialize () {
})

window.addEventListener('hashchange', markCurrentHashInSidebar)
window.addEventListener('exdoc:loaded', markCurrentHashInSidebar)

// We listen to swup:page:view event because we need to trigger
// markCurrentHashInSidebar() before scollNodeListToCurrentCategory.
window.addEventListener('swup:page:view', markCurrentHashInSidebar)
markCurrentHashInSidebar()

// Triggers layout, defer.
requestAnimationFrame(scrollNodeListToCurrentCategory)
Expand Down

0 comments on commit 0916d53

Please sign in to comment.