Skip to content

Commit

Permalink
Try: Flip orientation of submenus that are towards the right of the v…
Browse files Browse the repository at this point in the history
…iewport. (#30342)
  • Loading branch information
jasmussen authored Apr 6, 2021
1 parent 8be7a8d commit 4333b5a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/block-library/src/navigation-link/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
}

// Margin when justified right or space-between.
// Margin of right-most margin should be zero, for right aligned or justified items.
.wp-block-navigation__container > .wp-block-pages-list__item:last-child,
.wp-block-navigation__container > .wp-block-navigation-link:last-child {
margin-right: 0;
Expand Down Expand Up @@ -181,6 +181,27 @@
}
}
}


// When justified space-between, open submenus leftward for last menu item.
// When justified right, open all submenus leftwards.
&.items-justified-space-between > .submenu-container > .has-child:last-child,
&.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child,
&.items-justified-right .has-child {
// First submenu.
.submenu-container,
.wp-block-navigation-link__container {
left: auto;
right: 0;

// Nested submenus.
.submenu-container,
.wp-block-navigation-link__container {
left: auto;
right: 100%;
}
}
}
}

// Default background and font color.
Expand Down
6 changes: 6 additions & 0 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
&.has-child .block-editor-block-list__block.wp-block-navigation-link {
margin: 0;
}

// Margin of right-most margin should be zero, for right aligned or justified items.
&.wp-block-pages-list__item:last-child,
&.wp-block-navigation-link:last-child {
margin-right: 0;
}
}
}

Expand Down

0 comments on commit 4333b5a

Please sign in to comment.