Skip to content

Commit

Permalink
Merge branch 'navigating-browser-history-issue' of https://github.com…
Browse files Browse the repository at this point in the history
…/RONAK-AI647/kolibri-design-system into RONAK-A1647#213-Improve-browser-history-integration-with-the-navigation-Table-of-Contents-(ToC)-filter
  • Loading branch information
RONAK-AI647 committed Dec 16, 2024
2 parents bfb7973 + be4c1ed commit cdc9887
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/common/DocsPageTemplate/SideNav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@
}, 2000); // 2-second debounce delay
}
// Modify navigation links to preserve the filter query
this.$nextTick(() => {
this.$refs.links.querySelectorAll('a').forEach(link => {
link.addEventListener('click', event => {
event.preventDefault();
const href = new URL(link.href);
this.$router.push({
path: href.pathname,
query: { ...this.$route.query }, // Add existing query params to the new path
});
});
});
});
// Don't show the nav until the state is set
this.loaded = true;
},
Expand Down

0 comments on commit cdc9887

Please sign in to comment.