Skip to content
Snippets Groups Projects
Commit e5b406d6 authored by Clement Ho's avatar Clement Ho Committed by Mike Greiling
Browse files

Replace deprecated bs.affix in merge request tabs with sticky polyfill

parent 436d17a0
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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);
}
}
---
title: Replace deprecated bs.affix in merge request tabs with sticky polyfill
merge_request:
author:
type: fixed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment