mediawiki-skins-Vector/resources/skins.vector.styles/components/TableOfContents.less
bwang 4efafaf374 Fix TOC scrollable indicator
Causes 4 minor visual regressions where the collapsed toc width is slightly smaller
will be fixed when page tools is deployed.
https://jmp.sh/o3vlGVlb

- Remove @padding-vertical-toc, @padding-right-toc and @padding-left-toc variables, which would need to be removed after page tools is enabled anyway
- Remove @height-collapsed-toc-button, @padding-top-content-px and @max-width-collapsed-toc variables which weren't needed
- Greatly simplify CSS for collapsed TOC width

Bug: T324877
Change-Id: I6d44d4b49fb5dccd776dfe0e96740fdb9bff4c5d
2023-01-10 17:21:26 -06:00

168 lines
4.2 KiB
Plaintext

@import '../../common/variables.less';
// FIXME: Remove all .sidebar-toc selectors after I5b9228380f5c4674ef424d33127a5cb4010822da is in prod for 5 days
.sidebar-toc,
.vector-toc {
max-height: 75vh;
box-sizing: border-box;
overflow-y: auto;
overflow-x: hidden;
background-color: @background-color-page-container;
.vector-feature-page-tools-disabled & {
padding: 20px 12px 20px 27px;
.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;
}
.sidebar-toc-numb,
.vector-toc-numb {
display: none;
}
.sidebar-toc-toggle,
.vector-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 * @{size-toc-subsection-toggle-icon} - 1px )'; // leaves 6px between icon + text
width: @size-toc-subsection-toggle-icon; // ~22px @ 12
height: @size-toc-subsection-toggle-icon;
font-size: 0.75em; // reduces size of toggle icon to 12px @ 16
transition: @transition-duration-base;
color: transparent;
cursor: pointer;
.vector-feature-page-tools-enabled & {
// Vertically center the icon with the text
margin-top: 2px;
}
}
.sidebar-toc-link,
.vector-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,
.vector-toc-list-item-active,
.vector-toc-level-1-active:not( .vector-toc-list-item-expanded ),
.vector-toc-list-item-active.vector-toc-level-1-active {
> .sidebar-toc-link,
> .vector-toc-link {
// Highlight active section
color: @color-base;
font-weight: bold;
.sidebar-toc-text,
.vector-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% + @{padding-horizontal-dropdown-menu-item} )';
}
}
}
// Highlight active top sections that contain an active section
.sidebar-toc-level-1-active:not( .sidebar-toc-list-item-active ) > .sidebar-toc-link,
.vector-toc-level-1-active:not( .vector-toc-list-item-active ) > .vector-toc-link {
color: @color-base;
}
.sidebar-toc-text,
.vector-toc-text {
.vector-feature-page-tools-disabled & {
padding: 4px 0;
}
.vector-feature-page-tools-enabled & {
// Match .mixin-vector-dropdown-menu-item() vertical padding
padding: @padding-vertical-dropdown-menu-item 0;
}
}
.sidebar-toc-contents,
.sidebar-toc-list,
.vector-toc-contents,
.vector-toc-list {
margin: 0;
list-style: none;
.vector-feature-page-tools-disabled & {
line-height: 18px;
}
}
.sidebar-toc-list-item,
.vector-toc-list-item {
display: block;
position: relative;
list-style-type: none;
padding-left: 8px;
.vector-feature-page-tools-enabled & {
margin: 0;
}
&.sidebar-toc-level-1,
&.vector-toc-level-1 {
padding-left: 0;
}
a {
font-size: @font-size-base;
}
}
}
// Collapse ToC sections by default, excluding no-js
.client-js .sidebar-toc,
.client-js .vector-toc {
.sidebar-toc-level-1 .sidebar-toc-list-item,
.vector-toc-level-1 .vector-toc-list-item {
display: none;
}
.sidebar-toc-level-1.sidebar-toc-list-item-expanded .sidebar-toc-list-item,
.vector-toc-level-1.vector-toc-list-item-expanded .vector-toc-list-item {
display: block;
}
.sidebar-toc-toggle,
.vector-toc-toggle {
display: block;
}
.sidebar-toc-level-1.sidebar-toc-list-item-expanded .sidebar-toc-toggle,
.vector-toc-level-1.vector-toc-list-item-expanded .vector-toc-toggle {
transform: rotate( 0deg );
}
}
.client-js body.ltr .sidebar-toc .sidebar-toc-toggle,
.client-js body.ltr .vector-toc .vector-toc-toggle {
transform: rotate( -90deg );
}
.client-js body.rtl .sidebar-toc .sidebar-toc-toggle,
.client-js body.rtl .vector-toc .vector-toc-toggle {
transform: rotate( 90deg );
}