mediawiki-skins-Vector/resources/skins.vector.styles/components/LanguageButton.less
Jan Drewniak 3c0559a71d Refactor chevron across components + separate watchstar
Consolidates the CSS responsible for styling chevrons into one
implementation. This removes the need for custom padding and
background positioning for the following components:

- "more" menu
- user menu
- watchstar
- language button
- languge button in sticky header

Instead of absolutely positioning the chevron on these components,
the parent label element is set to `display: inline-flex` so that
the chevron is vertically aligned and given enough space by default.

The watchstar, although not a chevron, is also given the
`display: inline-flex` treatment so that it can be aligned with
other elements in the toolbar.

This new implementation requires splitting the watchstar
component into legacy and modern due to a quirk in Firefox that
causes a bug with the watchstar in legacy Vector.

NOTE: This change causes visual changes due to the difference in
centering the chevrons via flexbox vs percentage positions.

Bug: T308344, T310838
Change-Id: Ie9e0fce1366cd25a5899fee49770de4a09424fe2
2022-07-21 10:14:21 -04:00

92 lines
2.5 KiB
Plaintext

// The use of mixins.buttons requires @font-size-base to be defined for this to work in Storybook
@import '../../common/variables.less';
@import 'mediawiki.mixins.less';
// Note vector-language-in-header-enabled class is not used here as that class
// only applies to main page.
// This must be limited to mw-body-header as the mw-portlet-lang class is shared with
// the language portlet that can display in the sidebar.
.mw-body-header .mw-portlet-lang {
// FIXME [review whether margin-top is needed] center vertically in heading.
margin-top: 2px;
box-sizing: border-box;
height: @height-lang-button;
.mw-ui-icon:before {
// Put icon on correct standard normal state color.
opacity: 0.87;
}
.vector-menu-heading {
// Prevent select of span text "X languages"
user-select: none;
// Remove opacity on language button (it applies to more menu because of label color).
opacity: 1;
.vector-menu-heading-label {
// Special treatment for language button, based on Vector font-size
font-size: @font-size-base;
}
// T291286: Temporarily use progressive ULS style
&.mw-ui-progressive.mw-ui-quiet {
.mw-ui-icon:before {
// Ensure inverted language icon is white
opacity: 1;
}
&:after {
// Invert arrow color
background-image: url( ../common/images/arrow-down-progressive.svg );
opacity: 1;
}
}
}
input:active + .vector-menu-heading {
&.mw-ui-progressive.mw-ui-quiet {
.mw-ui-icon {
// stylelint-disable-next-line plugin/no-unsupported-browser-features
filter: brightness( 0 ) invert( 1 );
}
&:after {
background-image: url( ../common/images/arrow-down-invert.svg );
}
}
}
.vector-menu-content {
top: auto;
left: -@border-width-base;
right: -@border-width-base;
// align borders of open menu align with button
box-sizing: border-box;
max-height: 65vh;
overflow: auto;
// Adds to the show/hide technique in MenuDropdown.less with
// display to prevent rendering and long scrolling on Main page
display: none;
li a {
font-size: inherit;
}
}
.vector-menu-checkbox:checked ~ .vector-menu-content {
display: block;
}
.after-portlet {
// ensure there is a visual separation between the language links and additional links.
margin-top: 10px;
}
}
// Hides language button with CSS, ensures language button is in DOM for temporary JS hack for interwiki links
// Temporary solution to T287206, can be removed when ULS dialog includes interwiki links
#p-lang-btn.mw-portlet-empty {
display: none;
}