diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-06-29 23:22:00 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-06-29 23:22:00 +0300 |
commit | e5b406d64c0a94dcf62f5ff0b978a25b99133356 (patch) | |
tree | db58328245749241a8556173ed7f56b2e5d48209 | |
parent | 436d17a096d94ec93e31e5d5bccb969fdad0baf1 (diff) |
Replace deprecated bs.affix in merge request tabs with sticky polyfill
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js | 19 | ||||
-rw-r--r-- | changelogs/unreleased/47661-merge-request-box-disappearing-on-chrome.yml | 5 |
2 files changed, 7 insertions, 17 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 329d4303132..7d6f1000ebe 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -16,6 +16,7 @@ import Diff from './diff'; import { localTimeAgo } from './lib/utils/datetime_utility'; import syntaxHighlight from './syntax_highlight'; import Notes from './notes'; +import { polyfillSticky } from './lib/utils/sticky'; /* eslint-disable max-len */ // MergeRequestTabs @@ -426,7 +427,6 @@ export default class MergeRequestTabs { initAffix() { const $tabs = $('.js-tabs-affix'); - const $fixedNav = $('.navbar-gitlab'); // Screen space on small screens is usually very sparse // So we dont affix the tabs on these @@ -439,21 +439,6 @@ export default class MergeRequestTabs { */ if ($tabs.css('position') !== 'static') return; - const $diffTabs = $('#diff-notes-app'); - - $tabs - .off('affix.bs.affix affix-top.bs.affix') - .affix({ - offset: { - top: () => $diffTabs.offset().top - $tabs.height() - $fixedNav.height(), - }, - }) - .on('affix.bs.affix', () => $diffTabs.css({ marginTop: $tabs.height() })) - .on('affix-top.bs.affix', () => $diffTabs.css({ marginTop: '' })); - - // Fix bug when reloading the page already scrolling - if ($tabs.hasClass('affix')) { - $tabs.trigger('affix.bs.affix'); - } + polyfillSticky($tabs); } } diff --git a/changelogs/unreleased/47661-merge-request-box-disappearing-on-chrome.yml b/changelogs/unreleased/47661-merge-request-box-disappearing-on-chrome.yml new file mode 100644 index 00000000000..7e6ab8d448b --- /dev/null +++ b/changelogs/unreleased/47661-merge-request-box-disappearing-on-chrome.yml @@ -0,0 +1,5 @@ +--- +title: Replace deprecated bs.affix in merge request tabs with sticky polyfill +merge_request: +author: +type: fixed |