mediawiki-skins-MinervaNeue/resources/skins.minerva.base.styles/pageactions.less
Stephen Niedzielski b594daf8c8 Fix: AMC overflow menu initial CSS and SSR icons
When advanced mobile contributions is enabled and the overflow menu is
shown:

- The initial state should have no transition. This prevents the menu
  from flickering initially. Move the transition to the checked state
  only.

- The icons should be available for server-side rendered HTML without
  JavaScript. Add wikimedia.ui to the SSR modules.

Bug: T216418#5129152
Change-Id: I3b91f6cdefd4b727c2fb512272d8c4282af632bf
2019-05-01 09:29:50 -06:00

218 lines
5.6 KiB
Plaintext

@import '../../minerva.less/minerva.variables';
@import '../../minerva.less/minerva.mixins';
.heading-holder {
padding: @titleSectionSpacingTop 0 0;
position: relative;
.tagline {
color: @colorGray5;
font-size: @taglineFontSize;
}
}
.page-heading {
margin-bottom: 12px;
}
// used to disable the languages icon.
.mw-ui-icon-element.disabled {
cursor: default;
opacity: 0.25;
}
#page-actions {
position: relative;
}
.page-actions-menu {
.box-sizing( border-box );
border-top: 1px solid @colorGray14;
border-bottom: 1px solid @colorGray12;
}
.page-actions-menu__list {
display: flex;
justify-content: space-between;
height: @pageActionToolbarHeight;
}
.page-actions-menu__list-item {
display: flex;
flex-basis: 4em;
justify-content: flex-end;
align-items: center;
// overriding default icon styles
.mw-ui-icon-element {
// The page actions menu icons are ever so slightly larger
// than standard icons.
@pageActionsIconSize: @iconSize + 0.15;
// explicitly added to ensure this element (which is an anchor) receives width/height
// when it's viewed in services that manipulate DOM such as Google Translate.
display: block;
position: relative;
min-width: @pageActionsIconSize;
width: @pageActionsIconSize;
height: @pageActionsIconSize;
&:hover {
box-shadow: none;
}
&:before {
margin: 0;
// `.mw-ui-icon` absolutely positions this pseudo-element but only
// positions right & left. This ensures icon stretches 100% height and
// stretches the entire height of its parent element.
top: 0;
bottom: 0;
}
}
}
.minerva--amc-enabled .page-actions-menu__list-item {
flex-basis: auto;
}
// Layout for less than 5 items - one item at the beginning, rest at the end.
// |1-----2--3--4|
.page-actions-menu__list-item:first-child {
flex-grow: 1;
justify-content: flex-start;
}
// When AMC is enabled, space all items equally.
.minerva--amc-enabled .page-actions-menu__list-item:first-child {
flex-grow: 0;
}
#toolbar-overflow-menu__checkbox {
// Always occlude the checkbox. The checkbox display cannot be none since its focus state is used
// for other selectors.
position: absolute;
z-index: @z-indexOccluded;
opacity: 0;
}
.toolbar-overflow-menu__button {
// Use the hand icon for the overflow button which is actually a checkbox label.
cursor: pointer;
}
#toolbar-overflow-menu__checkbox:focus + .toolbar-overflow-menu__button {
// The overflow button / label itself cannot receive focus but the underlying checkbox can. Keep
// the button and checkbox focus presentation in sync. From
// resources/src/mediawiki.toc.styles/screen.less.
outline: dotted 1px; /* Firefox style for focus */
outline: auto @colorProgressiveHighlight; /* Webkit style for focus */
}
.touch-events #toolbar-overflow-menu__checkbox:focus + .toolbar-overflow-menu__button {
// Buttons have no focus outline on mobile.
outline: 0;
}
.toolbar-overflow-menu__list {
// The top of the menu is flush with the bottom of the page actions toolbar.
position: absolute;
top: 100%;
right: 0;
//
// A variable max-height is set in JavaScript so a minimum height is needed.
min-height: 200px;
//
// If the height exceeds the maximum allowed, add a vertical scrollbar.
overflow-y: auto;
//
// The menu floats over content but below overlays.
z-index: @z-indexDrawer;
//
font-size: @pageActionFontSize;
font-weight: bold;
background: @skinContentBgColor;
box-shadow: 0 5px 17px 0 rgba( 0, 0, 0, 0.24 ), 0 0 1px @colorGray10;
border-radius: @borderRadius;
//
visibility: hidden;
opacity: 0;
transform: translateY( -8px );
// Animate menu visibility, opacity, and translation changes in and out. Visibility must be
// animated since it's a boolean and nothing can be seen in display hidden. Visibility itself
// cannot be animated as it causes a flash on page load in Chromium due to
// https://bugs.chromium.org/p/chromium/issues/detail?id=332189. The effect is that the menu is
// animated in but not animated out.
.transition( opacity .1s ease-in-out, transform .1s ease-in-out; );
}
.toolbar-overflow-menu__list-item {
// Fill the list item cell.
.box-sizing( border-box );
display: inline-block;
width: 100%;
//
padding: 1em;
white-space: nowrap;
// Left-align text. Button elements are centered.
text-align: left;
//
color: @grayMediumDark;
&:visited, &:active {
// Visited and active links need extra specificity.
color: @grayMediumDark;
}
//
// Make the app feel like an app, not a JPEG. When hovering over a menu item, add a little
// interactivity.
&:hover {
text-decoration: none;
background: @grayLightest;
}
}
#toolbar-overflow-menu__checkbox:checked ~ .toolbar-overflow-menu__list {
// Reveal the overflow menu when checked.
visibility: visible;
opacity: 1;
transform: translateY( 0 );
}
// overriding common.less `display:inherit` (which causes `display: flex;` in this instance).
.client-js .jsonly#ca-watch {
display: list-item;
}
// Watchstar is hidden for anonymous no-js users
// While we could link the icon to the login/signup form, this is not
// a perfect experience and could be confusing.
// In JavaScript this icon will be converted to a watch icon and will point
// to a Call to action to sign up/login and explain why that's a good idea.
// Thus, anonymous users without JS will never see this icon.
// This is a small % of our users, so deemed okay.
.client-nojs {
.watch-this-article {
visibility: hidden;
}
.is-authenticated {
.watch-this-article {
visibility: visible;
}
}
}
// On small devices that don't support Javascript, hide the page actions bar
@media all and ( max-width: @width-breakpoint-mobile - 1 ) {
.client-nojs {
#page-actions {
display: none;
}
#section_0 {
border: 0;
}
}
}