2022-06-08 15:03:38 +00:00
|
|
|
@import '../../common/variables.less';
|
2022-09-29 22:54:55 +00:00
|
|
|
@import '../../common/mixins.less';
|
2022-06-08 15:03:38 +00:00
|
|
|
|
2022-07-01 20:19:57 +00:00
|
|
|
@height-collapsed-toc-button: 36px;
|
|
|
|
@padding-top-content-px: unit( @padding-top-content * @font-size-browser, px );
|
|
|
|
@selector-collapsed-toc-open: ~'#vector-toc-collapsed-checkbox:checked';
|
2022-09-09 16:22:07 +00:00
|
|
|
// Use calc so that the same max width can apply even when the TOC is in different containers
|
|
|
|
@max-width-collapsed-toc: 0.85 * @max-width-content-container; // 51em
|
2022-06-10 17:58:21 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
.mixin-toc-dropdown-button() {
|
2022-06-08 15:03:38 +00:00
|
|
|
display: none;
|
2022-07-08 16:13:32 +00:00
|
|
|
margin-right: 4px;
|
2022-11-21 22:16:07 +00:00
|
|
|
z-index: @z-index-menu;
|
|
|
|
// Override background color for when the TOC button overlaps content
|
|
|
|
// as a fixed element when the page is scrolled down.
|
2022-07-08 16:13:32 +00:00
|
|
|
background-color: @background-color-base;
|
|
|
|
}
|
2022-06-08 15:03:38 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
#vector-toc-collapsed-button {
|
|
|
|
.mixin-toc-dropdown-button();
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
// FIXME: Remove selector after Iea0d73005b91589c58ae38a3a640fa90c18a860d has been in prod for 5 days
|
|
|
|
@media ( min-width: @min-width-desktop ) {
|
|
|
|
// Disable collapsible TOC behavior for cached HTML on non mobile viewports
|
|
|
|
.vector-toc-cached .sidebar-toc .vector-pinnable-header-toggle-button {
|
2022-08-15 16:34:28 +00:00
|
|
|
display: none !important; /* stylelint-disable-line declaration-no-important */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
@media ( max-width: @max-width-tablet ) {
|
|
|
|
// FIXME: Remove .vector-toc-cached after Iea0d73005b91589c58ae38a3a640fa90c18a860d has been in prod for 5 days
|
|
|
|
// Maintain collapsible TOC behavior for cached HTML on mobile by using no-js approach
|
|
|
|
.vector-toc-cached,
|
|
|
|
.client-nojs {
|
|
|
|
#vector-toc-collapsed-button {
|
|
|
|
display: block;
|
|
|
|
// Override the default button styles so the ToC button is slightly shorter when collapsed into the page title
|
|
|
|
padding: 7px 12px;
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
&:active {
|
|
|
|
background-color: @colorGray15;
|
|
|
|
}
|
|
|
|
}
|
2022-07-01 20:19:57 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
// FIXME: Remove .vector-sticky-toc-container selector after I85aec387f87126a17e760fd9fd10e10572ff3152 has been in prod for 5 days
|
|
|
|
.vector-sticky-toc-container,
|
|
|
|
#vector-toc-pinned-container {
|
|
|
|
// Override TOC container's sticky positioning
|
|
|
|
position: relative;
|
|
|
|
}
|
2022-07-01 20:19:57 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
.sidebar-toc {
|
|
|
|
display: none;
|
|
|
|
position: absolute;
|
|
|
|
width: auto;
|
|
|
|
min-width: 200px;
|
|
|
|
// using min() so that the TOC menu doesn't fully cover the text even on small viewports
|
|
|
|
max-width: ~'min( @{max-width-collapsed-toc}, 75vw )';
|
|
|
|
top: @height-collapsed-toc-button; // TOC button height
|
|
|
|
// FIXME: Don't use a magic number. This used to be tied to the private variable in core
|
|
|
|
// @icon-padding-md so perhaps this needs to make use of the flush classes?
|
|
|
|
left: -12px;
|
|
|
|
margin-top: @padding-top-content-px; // Account for padding-top from .mw-body
|
|
|
|
// FIXME: Collapsed TOC styles are not consistent with other vector dropdowns
|
|
|
|
border: @border-width-base @border-style-base @border-color-base;
|
|
|
|
z-index: @z-index-menu;
|
|
|
|
}
|
2022-07-01 20:19:57 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
@{selector-collapsed-toc-open} ~ .mw-table-of-contents-container .sidebar-toc {
|
|
|
|
// Hide the TOC when the button is not checked
|
|
|
|
display: block;
|
|
|
|
}
|
2022-10-20 21:32:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
.vector-page-titlebar-toc {
|
|
|
|
.mixin-toc-dropdown-button();
|
2022-09-09 16:22:07 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
&.ve-active {
|
|
|
|
display: none !important; /* stylelint-disable-line declaration-no-important */
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
.vector-menu-heading {
|
|
|
|
// Override the default button styles so the ToC button is slightly shorter when collapsed into the page title
|
|
|
|
@media ( max-width: @max-width-tablet ) {
|
|
|
|
padding: 7px 12px;
|
|
|
|
}
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
2022-11-21 22:16:07 +00:00
|
|
|
}
|
2022-06-08 15:03:38 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
// Styles for the "move to sidebar/hide" buttons, hidden by default.
|
|
|
|
// FIXME: Remove entire selector when I82f23e69b0249c844af9e45fec342217a0755893 has been in prod for a week
|
|
|
|
.client-js {
|
|
|
|
@media ( min-width: @min-width-desktop ) {
|
|
|
|
.vector-toc-unpinned .vector-toc-uncollapse-button,
|
|
|
|
.vector-toc-pinned .vector-toc-collapse-button {
|
|
|
|
display: inline-block;
|
|
|
|
}
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
.vector-toc-collapse-button,
|
|
|
|
.vector-toc-uncollapse-button {
|
|
|
|
display: none;
|
|
|
|
border: 0;
|
|
|
|
padding: 0;
|
|
|
|
background-color: transparent;
|
|
|
|
color: @color-primary;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: @color-primary--hover;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: '@{msg-brackets-start}';
|
|
|
|
color: @color-base--subtle;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:after {
|
|
|
|
content: '@{msg-brackets-end}';
|
|
|
|
color: @color-base--subtle;
|
|
|
|
}
|
2022-06-10 17:58:21 +00:00
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
// Shared collapsed TOC styles, applies across all cases (page titlebar, sticky header, floating)
|
|
|
|
.mixin-toc-collapsed() {
|
|
|
|
// T316056 Use max-content because collapsed TOC is absolutely positioned, width is relative to the collapsed TOC button
|
|
|
|
// max-content doesn't account for padding even when we use box-sizing, so use content-box instead
|
|
|
|
// and manually account for horizontal padding in the max width
|
|
|
|
width: max-content;
|
|
|
|
box-sizing: content-box;
|
2022-07-26 20:57:51 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
// T316056 Remove TOC menu fixed width and apply min/max-width
|
|
|
|
// Account for padding so that the TOC has an effective max width of @max-width-collapsed-toc, or 51em
|
|
|
|
@sidebar-toc-left-padding-em: unit( @sidebar-toc-left-padding / @font-size-browser, em );
|
|
|
|
@sidebar-toc-right-padding-em: unit( @sidebar-toc-right-padding / @font-size-browser, em );
|
|
|
|
@max-width-collapsed-toc-content-box: @max-width-collapsed-toc - @sidebar-toc-right-padding-em - @sidebar-toc-left-padding-em;
|
|
|
|
min-width: 200px - @sidebar-toc-right-padding - @sidebar-toc-left-padding;
|
|
|
|
// using min() so that the TOC menu doesn't fully cover the text even on small viewports
|
|
|
|
max-width: ~'min( @{max-width-collapsed-toc-content-box}, 75vw )';
|
2022-07-26 20:57:51 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
// TOC styles when in page titlebar
|
|
|
|
.mixin-toc-collapsed-page-titlebar() {
|
|
|
|
.vector-page-titlebar-toc {
|
|
|
|
display: block;
|
|
|
|
|
|
|
|
.sidebar-toc {
|
|
|
|
.mixin-toc-collapsed();
|
|
|
|
}
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
.client-js {
|
|
|
|
@media ( max-width: @max-width-tablet ) {
|
|
|
|
// Prevent layout shift from the TOC being in the sidebar before JS loads and
|
|
|
|
// moves the TOC into the page titlebar on small screens
|
|
|
|
// FIXME: Remove .vector-sticky-toc-container selector after I85aec387f87126a17e760fd9fd10e10572ff3152 has been in prod for 5 days
|
|
|
|
.vector-sticky-toc-container .sidebar-toc,
|
|
|
|
#vector-toc-pinned-container .sidebar-toc {
|
|
|
|
display: none;
|
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
// Hide pin ToC toggles on smaller resolution
|
|
|
|
.sidebar-toc .vector-pinnable-header-toggle-button {
|
|
|
|
display: none;
|
|
|
|
}
|
2022-10-28 21:50:42 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
//
|
|
|
|
// TOC in page titlebar on narrow screens
|
|
|
|
//
|
|
|
|
.mixin-toc-collapsed-page-titlebar();
|
|
|
|
|
|
|
|
//
|
|
|
|
// TOC floating on narrow screens when below page title
|
|
|
|
//
|
|
|
|
.vector-below-page-title {
|
|
|
|
.vector-page-titlebar-toc {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
margin: 0;
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-09-09 16:22:07 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
@media ( min-width: @min-width-desktop ) {
|
|
|
|
//
|
|
|
|
// TOC in page titlebar
|
|
|
|
//
|
|
|
|
.vector-toc-unpinned:not( .vector-sticky-header-visible ) {
|
|
|
|
.mixin-toc-collapsed-page-titlebar();
|
|
|
|
}
|
2022-09-29 22:54:55 +00:00
|
|
|
|
2022-11-21 22:16:07 +00:00
|
|
|
//
|
|
|
|
// TOC in sticky header
|
|
|
|
//
|
|
|
|
.vector-toc-unpinned.vector-sticky-header-visible .sidebar-toc {
|
|
|
|
.mixin-toc-collapsed();
|
|
|
|
}
|
|
|
|
}
|
2022-09-09 16:22:07 +00:00
|
|
|
}
|