Skip to content

Commit f3bfebe

Browse files
committed
preserve hash (aka URL fragment) on version change
1 parent 25c4ff3 commit f3bfebe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/js/01-nav.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,9 @@
410410
versionListEl.addEventListener('change', function () {
411411
if (versionListEl.dataset.component === page.component) {
412412
var selection = versionListEl.options[versionListEl.selectedIndex]
413-
if (selection.dataset.url) {
414-
window.location.href = selection.dataset.url
413+
var selectionUrl = selection.dataset.url
414+
if (selectionUrl) {
415+
window.location.href = selectionUrl + (selectionUrl.startsWith('#') ? '' : window.location.hash)
415416
return
416417
}
417418
}

0 commit comments

Comments
 (0)