Change/Commit view has flickering bar

Summary

The commit/change view has a flickering toolbar if you scroll to a specific place.

Steps to reproduce

Scroll so the toolbar is in specific place, see example.

Example Project

On Gitlab.com: http://recordit.co/xLiARXQXMB

What is the current bug behavior?

It flickers really fast, much faster than shown in the gif.

What is the expected correct behavior?

No flicker

Relevant logs and/or screenshots

http://recordit.co/xLiARXQXMB

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

This bug happens on GitLab.com

Possible fixes

The is-stuck label is flickering on the files-changed bar.

It seems to be related to this code:

export const isSticky = (el, scrollY, stickyTop) => {
  const top = el.offsetTop - scrollY;

  if (top <= stickyTop) {
    el.classList.add('is-stuck');
  } else {
    el.classList.remove('is-stuck');
  }
};

export default (el) => {
  if (!el) return;

  const computedStyle = window.getComputedStyle(el);

  if (!/sticky/.test(computedStyle.position)) return;

  const stickyTop = parseInt(computedStyle.top, 10);

  document.addEventListener('scroll', () => isSticky(el, window.scrollY, stickyTop), {
    passive: true,
  });
};



// WEBPACK FOOTER //
// ./lib/utils/sticky.js
Assignee Loading
Time tracking Loading