mediawiki-skins-Vector/resources/skins.vector.styles/layouts/screen.less

170 lines
4.2 KiB
Plaintext
Raw Normal View History

/**
* Vector modern layout styles for screen
*
* Layout rules divide the page into sections and how VectorComponents should be arranged in the skin.
* The rules here should only define the layout, not color or typography.
*/
@import '../../common/variables.less';
@import 'mediawiki.mixins.less';
@selector-sidebar-no-toc-sidebar-closed: ~'#mw-sidebar-checkbox:not( :checked ) ~ .vector-sidebar-container-no-toc';
// Content container
// Note this uses variables defined in mediawiki.skin.variables so that VisualEditor can read them
// see T259331.
@padding-content: @padding-top-content @padding-horizontal-content 1.5em;
// Breakpoints
// Defines the minimum viewport width, at which point the layout will not get any
// smaller and will start horizontal scrolling instead.
@min-width-supported:
unit( 500px / @font-size-browser, em ) -
( 2 * @padding-horizontal-page-container-wide );
// 31.25em - 3.75em = 27.5em @ 16
body {
background-color: @background-color-secondary--modern;
color: @color-base;
// Vertical scrollbar always visible.
overflow-y: scroll;
}
.mw-body,
.parsoid-body {
direction: ltr;
}
.mw-body {
border-top: @border-width-base @border-style-base transparent;
/* Merge the border with tabs' one (in their background image) */
margin-top: -@border-width-base;
padding: @padding-content;
.firstHeading {
/* Change the default from mediawiki.skinning CSS to let indicators float into heading area */
overflow: visible;
margin-bottom: 0;
}
}
Switch to navigation-first DOM order under `$wgVectorIsSearchInHeader` feature flag This moves the header, navigation, sidebar, and article toolbar to be before the content in the DOM. As a result, a lot of absolute positioning logic can be removed and styles can be simplified. Note that although the sidebar was moved from the header into the workspace container allowing it to de-absolutely positioned, its absolute positioning was kept intact as it has a fair amount of complexity that should be handled in a separate task. To activate, set `$wgVectorIsSearchInHeader = true;` Changes that could cause concern: * The "jump to search" link was removed as the search is now much earlier in the DOM and I questioned the value of keeping this. However, it can be added back in if this change is contentious. * A "jump to content" link was added to account for the new DOM order. * Because the sidebar was taken out of the header, users will not be able to tab from the sidebar button into the sidebar without additional tweaking (e.g. should we add JS to enable this?). It was deemed that this work can be saved as a follow-up task. * I applied `overflow-y: auto` to the `mw-page-container` because the header's top margin was collapsing and caused whitespace to appear between the viewport and the header. Alternatively, we could apply a top padding to the page container and remove the header's top margin. I went for the simplest solution but am open to alternatives. * I left the footer as-is in this patch to minimize risk. It might be cleaner later on to move the footer inside the workspace container which would leave only one workspace container. Bug: T261802 Change-Id: Ic553fab3bde25769b103d899b92b3b694c00c384
2020-09-08 23:20:58 +00:00
.mw-header {
// allow z-index to apply so search results overlay article
position: relative;
z-index: @z-index-header;
}
.mw-body-content {
margin-top: 16px;
}
/* Main column */
.mw-body,
#mw-data-after-content,
.mw-footer {
margin-left: 0;
}
/* Content */
.mw-indicators {
z-index: @z-index-indicators;
}
.mw-body-header {
.mixin-clearfix();
}
.mw-body .mw-portlet-lang {
float: right;
}
.vector-body {
position: relative;
z-index: @z-index-base;
#siteSub {
margin-top: 8px; // T311564
}
#contentSub,
#contentSub2 {
// T311564: Override core styles to apply margin-top rather than margin-bottom
margin-top: 8px;
margin-bottom: 0;
}
}
Switch to navigation-first DOM order under `$wgVectorIsSearchInHeader` feature flag This moves the header, navigation, sidebar, and article toolbar to be before the content in the DOM. As a result, a lot of absolute positioning logic can be removed and styles can be simplified. Note that although the sidebar was moved from the header into the workspace container allowing it to de-absolutely positioned, its absolute positioning was kept intact as it has a fair amount of complexity that should be handled in a separate task. To activate, set `$wgVectorIsSearchInHeader = true;` Changes that could cause concern: * The "jump to search" link was removed as the search is now much earlier in the DOM and I questioned the value of keeping this. However, it can be added back in if this change is contentious. * A "jump to content" link was added to account for the new DOM order. * Because the sidebar was taken out of the header, users will not be able to tab from the sidebar button into the sidebar without additional tweaking (e.g. should we add JS to enable this?). It was deemed that this work can be saved as a follow-up task. * I applied `overflow-y: auto` to the `mw-page-container` because the header's top margin was collapsing and caused whitespace to appear between the viewport and the header. Alternatively, we could apply a top padding to the page container and remove the header's top margin. I went for the simplest solution but am open to alternatives. * I left the footer as-is in this patch to minimize risk. It might be cleaner later on to move the footer inside the workspace container which would leave only one workspace container. Bug: T261802 Change-Id: Ic553fab3bde25769b103d899b92b3b694c00c384
2020-09-08 23:20:58 +00:00
#left-navigation {
float: left;
margin-left: -@padding-horizontal-tabs;
Switch to navigation-first DOM order under `$wgVectorIsSearchInHeader` feature flag This moves the header, navigation, sidebar, and article toolbar to be before the content in the DOM. As a result, a lot of absolute positioning logic can be removed and styles can be simplified. Note that although the sidebar was moved from the header into the workspace container allowing it to de-absolutely positioned, its absolute positioning was kept intact as it has a fair amount of complexity that should be handled in a separate task. To activate, set `$wgVectorIsSearchInHeader = true;` Changes that could cause concern: * The "jump to search" link was removed as the search is now much earlier in the DOM and I questioned the value of keeping this. However, it can be added back in if this change is contentious. * A "jump to content" link was added to account for the new DOM order. * Because the sidebar was taken out of the header, users will not be able to tab from the sidebar button into the sidebar without additional tweaking (e.g. should we add JS to enable this?). It was deemed that this work can be saved as a follow-up task. * I applied `overflow-y: auto` to the `mw-page-container` because the header's top margin was collapsing and caused whitespace to appear between the viewport and the header. Alternatively, we could apply a top padding to the page container and remove the header's top margin. I went for the simplest solution but am open to alternatives. * I left the footer as-is in this patch to minimize risk. It might be cleaner later on to move the footer inside the workspace container which would leave only one workspace container. Bug: T261802 Change-Id: Ic553fab3bde25769b103d899b92b3b694c00c384
2020-09-08 23:20:58 +00:00
}
#right-navigation {
float: right;
margin-right: -@padding-horizontal-tabs;
// Any dropdowns inside the right navigation in modern Vector (e.g. "more" menu).
// should be right-aligned to prevent horizontal scrolling.
.vector-menu-content {
left: auto;
right: -@border-width-base;
}
}
.mw-table-of-contents-container {
// stylelint-disable-next-line plugin/no-unsupported-browser-features
position: sticky;
top: 0;
// Needed for Grid-based layout
align-self: start;
}
.parsoid-body {
padding: @padding-content;
}
.mw-footer {
border-top: @border-base;
padding: 0.75em;
}
// Container logic.
.mw-page-container {
// Setting position and z-index is important as it allows overlays appended to the body tag
// to position themselves over the Vector interface. This forms another stacking context for
// elements placed inside this element
position: relative;
z-index: 0;
max-width: @max-width-page-container;
// Fill the viewport even if the content height is small. This also helps
// mitigate a long sidebar overflowing the page container (T257518).
min-height: 100%;
margin-left: auto;
margin-right: auto;
// Use non-zero padding to disable margin collapse.
// Be careful not to use overflow-y: scroll here (see T270146 and T271868)
padding: 0.05px ( @padding-horizontal-page-container / 2 );
background-color: @background-color-page-container;
// Set a min-width to make explicit we do not support anything below this threshold.
// For devices too small, they should be more useable with horizontal scrolling.
// e.g. Portrait on an iPad
min-width: @min-width-supported;
@media ( min-width: @min-width-desktop ) {
padding-left: @padding-horizontal-page-container;
padding-right: @padding-horizontal-page-container;
}
@media ( min-width: @min-width-desktop-wide ) {
padding-left: @padding-horizontal-page-container-wide;
padding-right: @padding-horizontal-page-container-wide;
}
}
.skin--responsive .mw-page-container {
min-width: auto;
}
@import 'grid.less';