Commit abc50fa5 authored by Fatih Acet's avatar Fatih Acet

Merge branch...

Merge branch '27254-clicking-line-anchor-multiple-times-causes-scroll-position-to-over-correct' into 'master'

Resolve "Clicking line anchor multiple times causes scroll position to over-correct"

Closes #27254

See merge request !8791
parents 9eb39dde 5fbce683
/* eslint-disable class-methods-use-this */
//= require lib/utils/url_utility */
(() => {
const UNFOLD_COUNT = 20;
......@@ -104,11 +106,11 @@
}
highlighSelectedLine() {
const hash = gl.utils.getLocationHash();
const $diffFiles = $('.diff-file');
$diffFiles.find('.hll').removeClass('hll');
if (window.location.hash !== '') {
const hash = window.location.hash.replace('#', '');
if (hash) {
$diffFiles
.find(`tr#${hash}:not(.match) td, td#${hash}, td[data-line-code="${hash}"]`)
.addClass('hll');
......
......@@ -74,8 +74,9 @@
// If not done this way, the line number anchor will sometimes keep its
// active state even when the event is cancelled, resulting in an ugly border
// around the link and/or a persisted underline text decoration.
return $('#blob-content-holder').on('click', 'a[data-line-number]', function(event) {
return event.preventDefault();
$('#blob-content-holder').on('click', 'a[data-line-number]', function(event) {
event.preventDefault();
event.stopPropagation();
});
};
......
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