diff options
author | Ezekiel Kigbo <ekigbo@gitlab.com> | 2019-02-07 18:12:49 +1100 |
---|---|---|
committer | Ezekiel Kigbo <ekigbo@gitlab.com> | 2019-03-05 00:58:22 +1100 |
commit | 1622e86301bfc91118f21c6f849f51886b36da66 (patch) | |
tree | 767104d1828b15ea5260101194992484be805d89 | |
parent | 6b3966407baff221a0f1f9019fba34c29bafa087 (diff) | |
download | gitlab-ce-1622e86301bfc91118f21c6f849f51886b36da66.tar.gz |
Added DESKTOP_BREAKPOINTS constant
Chore: ensure sidebar-expanded-mobile toggles
Revert: toggleCollapseSidebar should not be called on xs breakpoints
-rw-r--r-- | app/assets/javascripts/contextual_sidebar.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/assets/javascripts/contextual_sidebar.js b/app/assets/javascripts/contextual_sidebar.js index eb30d14b6cd..f59d953c2f1 100644 --- a/app/assets/javascripts/contextual_sidebar.js +++ b/app/assets/javascripts/contextual_sidebar.js @@ -4,6 +4,7 @@ import _ from 'underscore'; import bp from './breakpoints'; import { parseBoolean } from '~/lib/utils/common_utils'; +const DESKTOP_BREAKPOINTS = ['xl', 'lg']; export default class ContextualSidebar { constructor() { this.initDomElements(); @@ -29,7 +30,7 @@ export default class ContextualSidebar { document.addEventListener('click', e => { if ( !e.target.closest('.nav-sidebar') && - !ContextualSidebar.isDesktopBreakpoint(bp.getBreakpointSize()) + (bp.getBreakpointSize() === 'sm' || bp.getBreakpointSize() === 'md') ) { this.toggleCollapsedSidebar(true, true); } @@ -54,7 +55,7 @@ export default class ContextualSidebar { // TODO: use the breakpoints from breakpoints.js once they have been updated for bootstrap 4 // See related issue and discussion: https://gitlab.com/gitlab-org/gitlab-ce/issues/56745 - static isDesktopBreakpoint = (_bp = '') => ['xl', 'lg'].indexOf(_bp) > -1; + static isDesktopBreakpoint = (_bp = '') => DESKTOP_BREAKPOINTS.indexOf(_bp) > -1; static setCollapsedCookie(value) { if (bp.getBreakpointSize() !== 'lg') { return; @@ -70,6 +71,7 @@ export default class ContextualSidebar { toggleMobileCollapsedSidebar(collapsed) { this.$sidebar.toggleClass('sidebar-collapsed-mobile', collapsed); + this.$sidebar.toggleClass('sidebar-expanded-mobile', !collapsed); this.$sidebar.removeClass('sidebar-collapsed-desktop'); this.$page.toggleClass('page-with-icon-sidebar', true); this.$page.toggleClass('page-with-contextual-sidebar', false); |