Skip to content

Commit

Permalink
pkp/pkp-lib#836 Prevent dropdown menus from opening off-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored and asmecher committed Nov 18, 2015
1 parent c7ac8e7 commit 07a09f5
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion plugins/themes/default/styles/helpers.less
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
left: -9999px;
z-index: 1000;
width: 15em;
margin: 0;
margin: 0;
padding: 0;
background: @primary-lift;

Expand Down Expand Up @@ -87,6 +87,26 @@
left: 0;
}

// Ensure a dropdown doesn't open beyond the edge of the screen by aligning
// such dropdowns to the right rather than the left.
li.align_right:hover > ul,
li.align_right:focus > ul,
li.align_right.in_focus > ul {
left: auto;
// Position in center on very small screens to prevent if from flying
// off to the left. Not a perfect solution, but should suffice for the
// overwhelming majority of cases
width: 10em;
right: 50%;
.transform(translateX(50%));

@media(min-width: @screen-phone) {
right: 0;
.transform(none);
width: 15em;
}
}

// Dropdown caret indicating submenus
// @todo these can probably abstracted into reusable components
.has-submenu > a:after {
Expand Down

0 comments on commit 07a09f5

Please sign in to comment.