mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-26 00:25:40 +00:00
e1d1de809f
- The collapsible ToC absolute positioning solution has been preserved to be used on no-js mobile resolutions - The collapsible ToC grid based positioning solution has been removed - ToC styles have been refactored and organzied This patch involves HTML changes. In order to avoid additional complexity, this patch disables the collapsible ToC feature for users above the mobile viewport with cached HTML. The ToC continues to be automatically collapsed on mobile viewports for cached HTML users. This patch results in 9 expected visual changes. In order to see them you need to take the following steps: 1. Run `./pixel.js reference` 2. Checkout the following PR in pixel https://github.com/wikimedia/pixel/pull/149 3. Run ./pixel.js test -c 859143 It should look like this: https://jmp.sh/ZVQqDZw7 Bug: T318013 Change-Id: Iea0d73005b91589c58ae38a3a640fa90c18a860d
192 lines
5.3 KiB
Plaintext
192 lines
5.3 KiB
Plaintext
@import '../../common/variables.less';
|
|
|
|
@sidebar-toc-fade-height: 30px;
|
|
@sidebar-toc-vertical-padding: 20px;
|
|
@sidebar-toc-right-padding: 12px;
|
|
// Sidebar TOC uses increased left padding and a negative left margin to achieve
|
|
// a 15px spacing without clipping the chevron icon
|
|
// https://phabricator.wikimedia.org/T312156#8095894
|
|
@sidebar-toc-left-padding: 15px + @sidebar-toc-right-padding;
|
|
@toc-subsection-toggle-icon-size: 1.834em;
|
|
|
|
.mw-table-of-contents-container {
|
|
// Needed for Grid-based layout
|
|
align-self: start;
|
|
height: 100%;
|
|
}
|
|
|
|
// FIXME: Remove .vector-sticky-toc-container selector after I85aec387f87126a17e760fd9fd10e10572ff3152 has been in prod for 5 days
|
|
.vector-sticky-toc-container,
|
|
#vector-toc-pinned-container {
|
|
// stylelint-disable-next-line plugin/no-unsupported-browser-features
|
|
position: sticky;
|
|
top: 0;
|
|
|
|
@media ( min-width: @min-width-desktop ) {
|
|
.vector-toc-pinned & {
|
|
// Default spacing separating the sidebar TOC from the main menu or viewport.
|
|
// Need to use padding in order for the spacing to apply when sticky
|
|
padding-top: 1.5em;
|
|
}
|
|
|
|
.vector-toc-pinned @{selector-main-menu-closed} ~ .mw-table-of-contents-container & {
|
|
// Needed to align TOC with bottom of title, 1.5em padding + 1.5em margin = 3em
|
|
margin-top: 1.5em;
|
|
}
|
|
|
|
.sidebar-toc,
|
|
.sidebar-toc:after {
|
|
// Align the left edge of the TOC text with the main menu button icon.
|
|
margin-left: -@sidebar-toc-left-padding;
|
|
}
|
|
|
|
// T302076: Add fade scrollable indicator when TOC is in sidebar
|
|
// Avoid showing indicator when the TOC is floating, or collapsed in the page title/sticky header
|
|
.vector-toc-pinned .sidebar-toc:after {
|
|
content: '';
|
|
display: block;
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: @sidebar-toc-fade-height;
|
|
background: linear-gradient( rgba( 255, 255, 255, 0 ), @background-color-page-container );
|
|
background-repeat: no-repeat;
|
|
background-position: -@sidebar-toc-right-padding; // T311436 Hacky way to prevent the fade from covering the scrollbar
|
|
pointer-events: none; // Make the link below the fade clickable
|
|
}
|
|
}
|
|
}
|
|
|
|
.sidebar-toc {
|
|
max-height: 75vh;
|
|
padding: @sidebar-toc-vertical-padding @sidebar-toc-right-padding @sidebar-toc-vertical-padding @sidebar-toc-left-padding;
|
|
box-sizing: border-box;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
background-color: @background-color-page-container;
|
|
|
|
// FIXME: Remove .sidebar-toc-header selector when I82f23e69b0249c844af9e45fec342217a0755893 has been in prod for a week
|
|
.sidebar-toc-header,
|
|
.vector-toc-pinnable-header {
|
|
// Override default pinnable header styles
|
|
padding: 0 0 12px 0;
|
|
border: 0;
|
|
line-height: initial;
|
|
}
|
|
|
|
.vector-pinnable-header-label {
|
|
// Override heading element styles in elements.less
|
|
overflow: unset;
|
|
}
|
|
|
|
// FIXME: Remove .sidebar-toc-title selector when I82f23e69b0249c844af9e45fec342217a0755893 has been in prod for a week
|
|
.sidebar-toc-title {
|
|
color: @color-base--subtle;
|
|
font-size: @font-size-base;
|
|
margin: 0;
|
|
padding: 0;
|
|
border: 0;
|
|
}
|
|
|
|
.sidebar-toc-numb {
|
|
display: none;
|
|
}
|
|
|
|
.sidebar-toc-toggle {
|
|
// For no-js users, toggling is disabled and icon is hidden
|
|
display: none;
|
|
position: absolute;
|
|
top: 1px; // visually center icon
|
|
left: ~'calc( -1 * @{toc-subsection-toggle-icon-size} - 1px )'; // leaves 6px between icon + text
|
|
width: @toc-subsection-toggle-icon-size; // ~22px @ 12
|
|
height: @toc-subsection-toggle-icon-size;
|
|
font-size: 0.75em; // reduces size of toggle icon to 12px @ 16
|
|
transition: @transition-duration-base;
|
|
color: transparent;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.sidebar-toc-link {
|
|
word-break: break-word;
|
|
color: @color-link;
|
|
display: block;
|
|
}
|
|
|
|
// Highlight and bold active sections, active top sections that are unexpanded
|
|
// and active top sections that are the only active element.
|
|
.sidebar-toc-list-item-active,
|
|
.sidebar-toc-level-1-active:not( .sidebar-toc-list-item-expanded ),
|
|
.sidebar-toc-list-item-active.sidebar-toc-level-1-active {
|
|
> .sidebar-toc-link {
|
|
// Highlight active section
|
|
color: @color-base;
|
|
font-weight: bold;
|
|
|
|
.sidebar-toc-text {
|
|
// Increase width to prevent line wrapping due to bold text
|
|
// Avoid applying on link element to avoid focus indicator changing size
|
|
width: ~'calc( 100% + @{sidebar-toc-right-padding} )';
|
|
}
|
|
}
|
|
}
|
|
|
|
// Highlight active top sections that contain an active section
|
|
.sidebar-toc-level-1-active:not( .sidebar-toc-list-item-active ) > .sidebar-toc-link {
|
|
color: @color-base;
|
|
}
|
|
|
|
.sidebar-toc-text {
|
|
padding: 4px 0;
|
|
}
|
|
|
|
.sidebar-toc-contents,
|
|
.sidebar-toc-list {
|
|
margin: 0;
|
|
list-style: none;
|
|
line-height: 18px;
|
|
}
|
|
|
|
.sidebar-toc-list-item {
|
|
display: block;
|
|
position: relative;
|
|
list-style-type: none;
|
|
padding-left: 8px;
|
|
|
|
&.sidebar-toc-level-1 {
|
|
padding-left: 0;
|
|
}
|
|
|
|
a {
|
|
font-size: @font-size-base;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Collapse ToC sections by default, excluding no-js
|
|
.client-js .sidebar-toc {
|
|
.sidebar-toc-level-1 .sidebar-toc-list-item {
|
|
display: none;
|
|
}
|
|
|
|
.sidebar-toc-level-1.sidebar-toc-list-item-expanded .sidebar-toc-list-item {
|
|
display: block;
|
|
}
|
|
|
|
.sidebar-toc-toggle {
|
|
display: block;
|
|
}
|
|
|
|
.sidebar-toc-level-1.sidebar-toc-list-item-expanded .sidebar-toc-toggle {
|
|
transform: rotate( 0deg );
|
|
}
|
|
}
|
|
|
|
.client-js body.ltr .sidebar-toc .sidebar-toc-toggle {
|
|
transform: rotate( -90deg );
|
|
}
|
|
|
|
.client-js body.rtl .sidebar-toc .sidebar-toc-toggle {
|
|
transform: rotate( 90deg );
|
|
}
|