Skip to content

Commit

Permalink
Merge pull request #1228 from thomthom/dev-fix-anchor-history
Browse files Browse the repository at this point in the history
Workaround for broken Browser Back for anchors. Fixes #1071
  • Loading branch information
lsegal committed Mar 31, 2019
2 parents 97d5a8a + 6866751 commit 7579761
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions templates/default/fulldoc/html/js/app.js
Expand Up @@ -275,6 +275,16 @@ function mainFocus() {
setTimeout(function() { $('#main').focus(); }, 10);
}

function navigationChange() {
// This works around the broken anchor navigation with the YARD template.
window.onpopstate = function() {
var hash = window.location.hash;
if (hash !== '' && $(hash)[0]) {
$(hash)[0].scrollIntoView();
}
};
}

$(document).ready(function() {
navResizer();
navExpander();
Expand All @@ -287,6 +297,7 @@ $(document).ready(function() {
constantSummaryToggle();
generateTOC();
mainFocus();
navigationChange();
});

})();

0 comments on commit 7579761

Please sign in to comment.