mediawiki-skins-Vector/resources/skins.vector.styles.legacy/components/MenuDropdown.less

148 lines
3.2 KiB
Plaintext
Raw Normal View History

@import '../../common/variables.less';
@import 'mediawiki.mixins.less';
@import '../../common/mixins.less';
// Flips the chevron so it points up when the dropdown is open.
.vector-menu-checkbox:checked + .vector-menu-heading::after {
transform: scaleY( -1 );
}
/**
* Dropdown menus that only appear in the tab bar in legacy Vector.
*/
.vector-menu-dropdown {
direction: ltr;
float: left;
cursor: pointer;
position: relative;
line-height: 1.125em;
// menu label with chevron icon.
.vector-menu-heading {
display: flex;
color: @color-subtle;
font-size: @font-size-tabs;
// Tab separator: Outer end (right in LTR) border of "Actions" menu.
background-position: right bottom;
margin: 0 -@border-width-base 0 0;
// `padding-top` needs to scale with font-size.
padding: 1.25em 8px 6px;
font-weight: normal;
&::after {
.mixin-vector-legacy-menu-heading-arrow();
// Modify the color of the image from the default #202122 to approx. #404244 to match the text.
opacity: @opacity-icon-base;
}
&:hover,
&:focus {
color: @color-base;
&::after {
opacity: @opacity-icon-base--selected;
}
}
}
/**
* Dropdown container. Hidden by default until checkbox is checked.
*/
.vector-menu-content {
position: absolute;
top: 100%;
left: -@border-width-base;
opacity: 0;
height: 0;
visibility: hidden;
overflow: hidden;
margin: 0;
padding: 0;
z-index: @z-index-dropdown;
line-height: 1.125em;
background-color: @background-color-base;
border: @border-width-base @border-style-base @border-color-base;
border-top-width: 0;
box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
transition-property: opacity;
transition-duration: @transition-duration-base;
// The menu content should not be narrower than the menu button.
min-width: 100%;
}
// Dropdown <ul> element.
> .vector-menu-content-list {
list-style: none;
}
// Open the dropdown container via hover.
&:hover .vector-menu-content {
opacity: @opacity-base;
visibility: visible;
height: auto;
}
.mw-list-item {
padding: 0;
margin: 0;
text-align: left;
line-height: 1em;
a:not( .vector-icon ) {
Refactor Vector tabs layout for reduced size & complexity Fix for iOS Safari 13 & 14 (T309223): - Replaces flex-box layout from the top-level #right-navigation and #left-navigation tab elements with floats. Then for vertical alignment, sets the child <li> elements and <a> elements to inline block. Opportunistic refactor (T308344): - Moves the font-size rules to top-level #left/right-navigation, but leaving them as-is for legacy Vector. - Removes a (seemingly) unnecessary `display:none` rule from Vector 2022, which previously applied to H3 labels in the sidebar, which are no longer targeted by the styles in MenuTabs.less. - Removes an unnecessary selector and duplicated rules from ArticleToolbar.less This change fixes a flexbox issue on iOS Safari 13 & 14, but also reduces the CSS bytesize of the skins.vector.styles module by 0.9kB (uncompressed), from 54.2kB in the previous commit to 53.3kB with this commit. Expected visual changes: * The tab underline now overlaps with the toolbar underline, and text pushed down on certain tabs * The variant tab is now equally spaced * Right navigation tabs slightly shifted to the right Unexpected visual changes: * More menu shifts to the left [see note at top of commit, will be fixed in a follow up] NOTE: this introduces a visual regression in the mobile viewport in that the more menu. Given this viewport is still experimental, after talking to Jan we agreed to address this in a follow-up. NOTE: Update addresses the reason for revert 5599cf2 and compatibility with CSS Grid layout by adding a clearfix (display:flow-root) for #right-navigation and #left-navigation elements inside toolbar. Bug: T309223 Bug: T308344 Bug: T312212 Change-Id: I1482a81d16c53e0ba1977b0d98ba8c8a21362a6c
2022-07-04 18:05:03 +00:00
font-size: @font-size-tabs;
}
a {
cursor: pointer;
// displays all links in a single column.
display: block;
white-space: nowrap;
padding: 0.625em;
color: @color-link;
}
&.selected a,
&.selected a:visited {
color: @color-link-selected;
text-decoration: none;
}
}
}
/**
* Invisible checkbox covering the dropdown menu handle.
*/
.vector-menu-checkbox {
cursor: pointer;
position: absolute;
top: 0;
left: 0;
z-index: @z-index-stacking-1;
opacity: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
// Hide the checkbox completely in browsers that don't support :checked
display: none;
// Hide and show menu content based off checked status.
&:checked ~ .vector-menu-content {
opacity: 1;
visibility: visible;
height: auto;
}
:not( :checked ) > & {
// When the browser supports :checked, display it
display: block;
}
// Add focus state to menu dropdown buttons (i.e. #p-variants, #p-cactions)
&:focus + .vector-menu-heading:not( .cdx-button ) {
// Simulate browser focus ring
outline: dotted 1px; // Firefox style
outline: auto -webkit-focus-ring-color; // Webkit style
}
}