Merge branch 'changes-bar-sticky-fix' into 'master'
Fixes the diff changes buttons from toggling when scrolling Closes #36698 See merge request !13894
This commit is contained in:
commit
8e60636984
4 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
export const isSticky = (el, scrollY, stickyTop) => {
|
||||
const top = el.offsetTop - scrollY;
|
||||
const top = Math.floor(el.offsetTop - scrollY);
|
||||
|
||||
if (top <= stickyTop) {
|
||||
el.classList.add('is-stuck');
|
||||
|
|
|
@ -253,6 +253,7 @@ import bp from './breakpoints';
|
|||
|
||||
loadDiff(source) {
|
||||
if (this.diffsLoaded) {
|
||||
document.dispatchEvent(new CustomEvent('scroll'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
5
changelogs/unreleased/changes-bar-sticky-fix.yml
Normal file
5
changelogs/unreleased/changes-bar-sticky-fix.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fixed diff changes bar buttons from showing/hiding whilst scrolling
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
|
@ -295,6 +295,17 @@ import 'vendor/jquery.scrollTo';
|
|||
this.class.loadDiff('/foo/bar/merge_requests/1/diffs');
|
||||
});
|
||||
|
||||
it('triggers scroll event when diff already loaded', function () {
|
||||
spyOn(document, 'dispatchEvent');
|
||||
|
||||
this.class.diffsLoaded = true;
|
||||
this.class.loadDiff('/foo/bar/merge_requests/1/diffs');
|
||||
|
||||
expect(
|
||||
document.dispatchEvent,
|
||||
).toHaveBeenCalledWith(new CustomEvent('scroll'));
|
||||
});
|
||||
|
||||
describe('with inline diff', () => {
|
||||
let noteId;
|
||||
let noteLineNumId;
|
||||
|
|
Loading…
Reference in a new issue