Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
0705acd6
Commit
0705acd6
authored
Mar 11, 2019
by
Luke Bennett
Committed by
Luke Bennett
May 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flyout nav on small viewports
Decouples sidebar collapsed style from behavior.
parent
b02fca96
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
+13
-3
app/assets/javascripts/contextual_sidebar.js
app/assets/javascripts/contextual_sidebar.js
+3
-0
app/assets/javascripts/fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+2
-1
changelogs/unreleased/ce-quick-fix-58727-collapsed-sidebar-flyout-menu-items-don-t-appear-in-1200px-screen-size.yml
...-flyout-menu-items-don-t-appear-in-1200px-screen-size.yml
+5
-0
spec/javascripts/fly_out_nav_spec.js
spec/javascripts/fly_out_nav_spec.js
+3
-2
No files found.
app/assets/javascripts/contextual_sidebar.js
View file @
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
'
,
...
...
app/assets/javascripts/fly_out_nav.js
View file @
0705acd6
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
())
{
...
...
changelogs/unreleased/ce-quick-fix-58727-collapsed-sidebar-flyout-menu-items-don-t-appear-in-1200px-screen-size.yml
0 → 100644
View file @
0705acd6
---
title
:
Fix flyout nav on small viewports
merge_request
:
25998
author
:
type
:
fixed
spec/javascripts/fly_out_nav_spec.js
View file @
0705acd6
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment