mediawiki-skins-Vector/resources/skins.vector.styles/components/TableOfContentsCollapsed.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

100 lines
2.2 KiB
Plaintext

@import '../../common/variables.less';
@selector-collapsed-toc-button-checked: ~'#vector-toc-collapsed-checkbox:checked';
#vector-toc-collapsed-button {
display: none;
}
@media ( max-width: @max-width-tablet ) {
#vector-toc-collapsed-button,
.sidebar-toc {
z-index: @z-index-menu;
}
#vector-toc-collapsed-button {
display: block;
float: left;
margin-right: 4px;
margin-left: -10px;
// Reduce padding to fit with page title
padding: 7px 10px 7px 10px;
// Override background color for when the TOC is overlaps content
// as a sticky element when the page is scrolled down.
background-color: @background-color-base;
&:hover,
&:active {
background-color: @colorGray15;
}
}
.mw-table-of-contents-container {
position: relative;
// Reset styles used by sticky TOC
top: 0;
}
.sidebar-toc {
position: absolute;
top: 44px;
left: -2px;
// !important needed to override rules in Sidebar.less
margin-top: 0 !important; /* stylelint-disable-line declaration-no-important */
// Dropdown styles
background-color: @color-base--inverted;
border: @border-width-base @border-style-base @border-color-base;
// Remove TOC fade
&:after {
display: none;
}
}
@{selector-collapsed-toc-button-checked} ~ .mw-table-of-contents-container .sidebar-toc {
// Unhide the TOC when the button is checked
display: block;
}
.vector-below-page-title {
#vector-toc-collapsed-button,
.sidebar-toc {
position: fixed;
}
#vector-toc-collapsed-button {
top: 0;
left: 0;
margin: 0;
}
.sidebar-toc {
// TOC button height
top: 36px;
left: 6px;
}
}
}
@media ( min-width: @min-width-tablet ) and ( max-width: @max-width-tablet ) {
body:not( .vector-below-page-title ) @{selector-checkbox-hack} .sidebar-toc {
// Adjust TOC for when the main menu is open, which pushes the page title to the right
left: 22px;
}
@{selector-collapsed-toc-button-checked} {
// Apply float styles to the TOC and main menu to ensure the absolute positioned TOC
// can remain in the correct location even when the main menu is open
& ~ .mw-table-of-contents-container {
clear: none;
float: left;
}
& ~ #mw-navigation .mw-sidebar {
float: left;
}
}
}