Commit 170b712f authored by Alfredo Sumaran's avatar Alfredo Sumaran

Merge branch '24876-page-jumps-to-wrong-position-when-clicking-a-comment-anchor' into 'master'

Fix instances where clicking a comment anchor twice will scroll to the wrong position

Closes #24876

See merge request !8046
parents 19e3ab18 49d28849
......@@ -89,6 +89,14 @@
// Set the default path for all cookies to GitLab's root directory
Cookies.defaults.path = gon.relative_url_root || '/';
// `hashchange` is not triggered when link target is already in window.location
$body.on('click', 'a[href^="#"]', function() {
var href = this.getAttribute('href');
if (href.substr(1) === gl.utils.getLocationHash()) {
setTimeout(gl.utils.handleLocationHash, 1);
}
});
// prevent default action for disabled buttons
$('.btn').click(function(e) {
if ($(this).hasClass('disabled')) {
......
---
title: ensure permalinks scroll to correct position on multiple clicks
merge_request: 8046
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment