Skip to content

Commit

Permalink
Fix expanded menu foundation#8325
Browse files Browse the repository at this point in the history
Fix foundation#8325.
See also: foundation#8779. Thanks to
@natewiebe13.

`.expanded` is a modifier for a horizontal menu, and should not be
applied on a vertical one.

Changes:
- Move the `.expanded` modifier after `.horizontal` and before
`.vertical`.
- Add the `.expanded` modifiers for each breakpoint with the
corresponding prefixes.

Other changes:
- Use `-zf-each-breakpoint` to generate responsive modifiers.

Note: The `.expanded` modifier should be applied only when the menu is
horizontal. For example, on a menu which is made horizontal on the
medium breakpoint, `.medium-expanded` should be used :
`.menu.vertical.medium-horizontal.medium-expanded`.
  • Loading branch information
ncoden committed Dec 4, 2016
1 parent 728bf88 commit 1c70a57
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions scss/components/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ $menu-border: $light-gray !default;
width: 100%;
table-layout: fixed;
}

> li:first-child:last-child {
width: 100%;
}
}

/// Sets the direction of a Menu.
Expand Down Expand Up @@ -237,24 +241,32 @@ $menu-border: $light-gray !default;
@include menu-base;
@include menu-icons;

// Orientation
@include menu-direction(horizontal);
// Default orientation: horizontal
&, &.horizontal {
@include menu-direction(horizontal);
}

// Even-width modifier for horizontal orientation
&.expanded {
@include menu-expand;
}

// Vertical orientation modifier
&.vertical {
@include menu-direction(vertical);
}

@each $size in $breakpoint-classes {
@if $size != $-zf-zero-breakpoint {
@include breakpoint($size) {
&.#{$size}-horizontal {
@include menu-direction(horizontal);
}
@include -zf-each-breakpoint($small: false) {
&.#{$-zf-size}-horizontal {
@include menu-direction(horizontal);
}

&.#{$size}-vertical {
@include menu-direction(vertical);
}
}
&.#{$-zf-size}-expanded {
@include menu-expand;
}

&.#{$-zf-size}-vertical {
@include menu-direction(vertical);
}
}

Expand All @@ -277,15 +289,6 @@ $menu-border: $light-gray !default;
}
}

// Even-width
&.expanded {
@include menu-expand;

> li:first-child:last-child {
width: 100%;
}
}

// Vertical icons
&.icon-top {
@include menu-icons(top, $base: false);
Expand Down

0 comments on commit 1c70a57

Please sign in to comment.