mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix: update location.hash when following links in preview (#60343)
This commit is contained in:
committed by
GitHub
parent
b772485fe6
commit
81502125dd
@@ -133,11 +133,7 @@ const createHeader = (id = mainPreviewId) =>
|
||||
else if (href.match(/^#.+/)) {
|
||||
e.preventDefault();
|
||||
const scrollId = href.substring(1);
|
||||
const scrollElem = document.getElementById(scrollId);
|
||||
|
||||
if (scrollElem) {
|
||||
scrollElem.scrollIntoView();
|
||||
}
|
||||
window.location.hash = scrollId;
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
Reference in New Issue
Block a user