mediawiki-skins-Vector/resources/skins.vector.zebra.styles/components/PinnableElement.less
bwang bae8b3d717 Consolidate sticky pinned element styles under .vector-sticky-pinned-container class
Bug: T335155
Change-Id: I988f3c7e70d602b4dbd5fd2cbd124b86b104caa7
2023-04-24 19:08:49 +00:00

70 lines
2.3 KiB
Plaintext

/**
* PinnableElement
* Pinned containers are typically dropdown menus that have been
* placed in a sidebar column, e.g. page tools menu, main menu.
*/
.vector-pinnable-element {
font-size: @font-size-dropdown;
}
.vector-pinned-container {
.mixin-vector-content-box();
padding: @padding-vertical-dropdown-menu @padding-horizontal-dropdown-menu;
margin-bottom: @grid-column-gap;
}
// Applies styles for making a pinned element sticky
// Mixin should be applied to the container element of `.vector-pinned-container`;
.vector-sticky-pinned-container {
height: 100%;
.vector-pinned-container {
// stylelint-disable-next-line plugin/no-unsupported-browser-features
position: sticky;
top: @grid-row-gap;
}
.vector-pinnable-element {
max-height: ~'calc( 100vh - @{grid-row-gap} - @{padding-vertical-dropdown-menu} - @{padding-vertical-dropdown-menu} - @{grid-row-gap} )';
overflow-y: auto;
&::after {
content: '';
display: block;
position: absolute;
// Offset position to account for menu borders.
bottom: @border-width-base;
// Offset to account for border radius.
left: @border-radius-content-box;
right: @border-radius-content-box;
height: @height-scroll-indicator;
background: linear-gradient( rgba( 255, 255, 255, 0 ), @background-color-page-container );
background-repeat: no-repeat;
background-position: -12px; // T311436 Hacky way to prevent the fade from covering the scrollbar
pointer-events: none; // Make the link below the fade clickable
}
}
}
/**
* At lower resolutions, we want to hide the pinned containers when JS is enabled since these
* elements collapse (become unpinned) at this resolution via PinnableElement.js.
* Although this is handled in JS, this rule prevents the pinned menu from
* appearing on pageload, at low resolutions, before the JS kicks in.
*
* When JS is disabled, we still want to hide the pinned containers at lower resolutions
* to fallback to the gradeC, single column layout.
*/
@media ( max-width: @max-width-tablet ) {
// .client-js and .client-nojs selectors needed to increase specificity to override gradeC.less
// Prefered to using !important as this still needs to be overridable to handle
// the anon, no-js TOC case found in layouts/toc/unpinned.less
&.client-js,
&.client-nojs {
.vector-pinned-container {
display: none;
}
}
}