mediawiki-skins-Vector/resources/skins.vector.styles/components/TableOfContents.less
bwang 8a88f61e89 Introduce media query breakpoint variables and replace all media query usage with new variables
Pixel shows 15 regressions, these are expected changes that are
fixing issues on specific viewports that fixes the following:

[At exactly the tablet breakpoint]
* the more menu dropdown was being
shown at the same time as the other menu items, resulting in duplicates
(see https://phabricator.wikimedia.org/F35285379)

[At exactly the desktop breakpoint]
* The table of contents AND the
table of contents toggle button to the left of the title were showing
(see https://phabricator.wikimedia.org/F35285392)
* The sticky header was not showing
* The fly out table of contents was showing instead of the sidebar
table of contents on scroll
* The top of the sidebar is brought into alignment with the tabs
(see https://phabricator.wikimedia.org/F35285408)

Bug: T310536
Change-Id: I6e870a032c8ba4ec003d00ff3f91732aaa2f38b0
2022-06-28 23:19:52 +00:00

144 lines
3.1 KiB
Plaintext

@import '../../common/variables.less';
@fade-height: 40px;
@vertical-padding: 20px;
@toggle-icon-size: 1.834em;
.sidebar-toc {
display: none;
width: @width-sidebar;
max-height: 75vh;
padding: @vertical-padding 12px @vertical-padding 32px;
box-sizing: border-box;
overflow: auto;
background-color: @border-color-sidebar;
@media ( min-width: @min-width-desktop-wide ) {
width: @width-sidebar-wide;
padding-right: 8px;
}
.sidebar-toc-header {
padding-bottom: 12px;
}
.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-link {
word-break: break-word;
color: @color-link;
}
.sidebar-toc-text {
padding: 4px 0;
}
.sidebar-toc-contents,
.sidebar-toc-list {
margin: 0;
list-style: none;
line-height: 18px;
}
.sidebar-toc-contents {
padding-bottom: ~'calc( @{vertical-padding} / 2 )';
}
.sidebar-toc-list-item {
display: block;
position: relative;
list-style-type: none;
padding-left: 8px;
a {
font-size: @font-size-base;
}
}
.sidebar-toc-list-item.sidebar-toc-level-1 {
padding-left: 0;
}
}
// T302076 Add scrollable indicator as fade
.sidebar-toc:after {
content: '';
display: block;
position: absolute;
bottom: 0;
left: @margin-start-sidebar-content; // T306893: Ensure scrollable indicator is contained in the TOC
right: @border-width-base; // Ensure scrollable indicator doesn't cover border/scrollbar
height: @fade-height;
background: linear-gradient( rgba( 255, 255, 255, 0 ), @border-color-sidebar );
pointer-events: none; // Make the link below the fade clickable
}
// Highlight active section
.sidebar-toc .sidebar-toc-list-item-active > .sidebar-toc-link {
color: @color-base;
}
.sidebar-toc .sidebar-toc-toggle {
// For no-js users, toggling is disabled and icon is hidden
display: none;
cursor: pointer;
}
// 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 {
position: absolute;
top: 1px; // visually center icon
left: ~'calc( -1 * @{toggle-icon-size} - 1px )'; // leaves 6px between icon + text
display: block;
width: @toggle-icon-size; // ~22px @ 12
height: @toggle-icon-size;
font-size: 0.75em; // reduces size of toggle icon to 12px @ 16
transition: @transition-duration-base;
}
.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 );
}
@media ( min-width: @min-width-desktop ) {
.sidebar-toc {
display: block;
}
}
// T300975 following media query for TOC experiment treatment
// class can be removed once associated A/B test is over.
@media ( max-width: @max-width-tablet ) {
.skin-vector-toc-experiment-treatment #toc {
display: table;
}
}