Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken URL History #4

Closed
seshrs opened this issue May 17, 2019 · 0 comments · Fixed by #7
Closed

Broken URL History #4

seshrs opened this issue May 17, 2019 · 0 comments · Fixed by #7
Assignees
Labels
bug Something isn't working

Comments

@seshrs
Copy link
Member

seshrs commented May 17, 2019

Clicking an internal link in the sidebar does not update the URL bar and the window history as expected. This is because the custom scrolling code prevents default browser behavior:

// When an internal link in the sidebar is clicked,
// execute custom code.
$('.primer-spec-toc-item > a').on('click', function() {
var $scroll_target = $($(this).attr('href'));
var scroll_position = $scroll_target.offset().top
- internal_link_offset;
// Scroll to the scroll_position.
$(window).scrollTop(scroll_position);
// If the settings pane is open, close it.
if (settings_is_shown) {
toggleSettings();
}
// On mobile, close the sidebar and settings.
if (isSmallScreen()) {
toggleSidebar();
}
return false;
});

Update the custom code to also update the window history.

@seshrs seshrs added the bug Something isn't working label May 17, 2019
@seshrs seshrs self-assigned this May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant