Skip to content

Commit

Permalink
preserve hash (aka URL fragment) on version change
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Jul 3, 2024
1 parent 25c4ff3 commit f3bfebe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/01-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,9 @@
versionListEl.addEventListener('change', function () {
if (versionListEl.dataset.component === page.component) {
var selection = versionListEl.options[versionListEl.selectedIndex]
if (selection.dataset.url) {
window.location.href = selection.dataset.url
var selectionUrl = selection.dataset.url
if (selectionUrl) {
window.location.href = selectionUrl + (selectionUrl.startsWith('#') ? '' : window.location.hash)
return
}
}
Expand Down

0 comments on commit f3bfebe

Please sign in to comment.