Commit 3b211391 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch...

Merge branch 'ce-quick-fix-58727-collapsed-sidebar-flyout-menu-items-don-t-appear-in-1200px-screen-size' into 'master'

CE Fix flyout nav on small viewports

See merge request gitlab-org/gitlab-ce!25998
parents 14c18677 0705acd6
...@@ -8,6 +8,8 @@ import { parseBoolean } from '~/lib/utils/common_utils'; ...@@ -8,6 +8,8 @@ import { parseBoolean } from '~/lib/utils/common_utils';
// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24555#note_134136110 // https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24555#note_134136110
const NAV_SIDEBAR_BREAKPOINT = 1200; const NAV_SIDEBAR_BREAKPOINT = 1200;
export const SIDEBAR_COLLAPSED_CLASS = 'js-sidebar-collapsed';
export default class ContextualSidebar { export default class ContextualSidebar {
constructor() { constructor() {
this.initDomElements(); this.initDomElements();
...@@ -62,6 +64,7 @@ export default class ContextualSidebar { ...@@ -62,6 +64,7 @@ export default class ContextualSidebar {
const breakpoint = bp.getBreakpointSize(); const breakpoint = bp.getBreakpointSize();
const dbp = ContextualSidebar.isDesktopBreakpoint(); const dbp = ContextualSidebar.isDesktopBreakpoint();
this.$sidebar.toggleClass(SIDEBAR_COLLAPSED_CLASS, !show);
this.$sidebar.toggleClass('sidebar-expanded-mobile', !dbp ? show : false); this.$sidebar.toggleClass('sidebar-expanded-mobile', !dbp ? show : false);
this.$overlay.toggleClass( this.$overlay.toggleClass(
'mobile-nav-open', 'mobile-nav-open',
......
import bp from './breakpoints'; import bp from './breakpoints';
import { SIDEBAR_COLLAPSED_CLASS } from './contextual_sidebar';
const HIDE_INTERVAL_TIMEOUT = 300; const HIDE_INTERVAL_TIMEOUT = 300;
const IS_OVER_CLASS = 'is-over'; const IS_OVER_CLASS = 'is-over';
...@@ -29,7 +30,7 @@ const setHeaderHeight = () => { ...@@ -29,7 +30,7 @@ const setHeaderHeight = () => {
}; };
export const isSidebarCollapsed = () => export const isSidebarCollapsed = () =>
sidebar && sidebar.classList.contains('sidebar-collapsed-desktop'); sidebar && sidebar.classList.contains(SIDEBAR_COLLAPSED_CLASS);
export const canShowActiveSubItems = el => { export const canShowActiveSubItems = el => {
if (el.classList.contains('active') && !isSidebarCollapsed()) { if (el.classList.contains('active') && !isSidebarCollapsed()) {
......
---
title: Fix flyout nav on small viewports
merge_request: 25998
author:
type: fixed
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
setSidebar, setSidebar,
subItemsMouseLeave, subItemsMouseLeave,
} from '~/fly_out_nav'; } from '~/fly_out_nav';
import { SIDEBAR_COLLAPSED_CLASS } from '~/contextual_sidebar';
import bp from '~/breakpoints'; import bp from '~/breakpoints';
describe('Fly out sidebar navigation', () => { describe('Fly out sidebar navigation', () => {
...@@ -219,7 +220,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -219,7 +220,7 @@ describe('Fly out sidebar navigation', () => {
it('shows collapsed only sub-items if icon only sidebar', () => { it('shows collapsed only sub-items if icon only sidebar', () => {
const subItems = el.querySelector('.sidebar-sub-level-items'); const subItems = el.querySelector('.sidebar-sub-level-items');
const sidebar = document.createElement('div'); const sidebar = document.createElement('div');
sidebar.classList.add('sidebar-collapsed-desktop'); sidebar.classList.add(SIDEBAR_COLLAPSED_CLASS);
subItems.classList.add('is-fly-out-only'); subItems.classList.add('is-fly-out-only');
setSidebar(sidebar); setSidebar(sidebar);
...@@ -296,7 +297,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -296,7 +297,7 @@ describe('Fly out sidebar navigation', () => {
it('returns true when active & collapsed sidebar', () => { it('returns true when active & collapsed sidebar', () => {
const sidebar = document.createElement('div'); const sidebar = document.createElement('div');
sidebar.classList.add('sidebar-collapsed-desktop'); sidebar.classList.add(SIDEBAR_COLLAPSED_CLASS);
el.classList.add('active'); el.classList.add('active');
setSidebar(sidebar); setSidebar(sidebar);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment