VectorGOLEM/resources/skins.vector.styles/layout-search-header.less
Nicholas Ray 78787d9665 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-09 18:31:35 +00:00

80 lines
2.5 KiB
Plaintext

// This assumes the presence of variables inside layout.less. DO NOT import it separately.
// Assumes various variables defined there.
@min-width-search: unit( 350px / @font-size-browser, em );
@max-width-search: unit( 580px / @font-size-browser, em );
@margin-horizontal-search: unit( 40px / @font-size-browser, em );
// The logo is variable width but typically consists of:
// - a icon (50x50)
// - a wordmark (approx 120px)
@min-width-logo: unit( 180px / @font-size-browser, em );
@min-width-personal-tools: unit( 300px / @font-size-browser, em );
@padding-horizontal-page-container: 30px;
@padding-horizontal-page-container-ems: unit( @padding-horizontal-page-container / @font-size-browser, em );
@margin-horizontal-sidebar-button-icon-ems: unit( @margin-horizontal-sidebar-button-icon / @font-size-browser, em );
@padding-horizontal-page-container-ems: unit( @padding-horizontal-page-container / @font-size-browser, em );
// the width of the container if you exclude consideration for search
@min-width-container-base: @padding-horizontal-page-container-ems + @size-sidebar-button + @margin-horizontal-sidebar-button-icon-ems + @min-width-logo + @min-width-personal-tools + @padding-horizontal-page-container-ems;
@min-width-supported: @min-width-container-base + @min-width-search;
@width-comfortable: @min-width-container-base + @margin-horizontal-search + @max-width-search + @margin-horizontal-search;
@height-personal-tools: 2em;
.skin-vector-search-header {
// Header components
#p-search {
// Override values to reflect new behaviour.
min-width: @min-width-search;
max-width: 100%;
margin: 0 0 0 @margin-horizontal-search;
#searchform {
margin-left: auto;
max-width: @max-width-search;
}
}
// Support IE9: float will be disabled if display flex is supported
#p-search,
#mw-sidebar-button {
float: left;
}
#p-personal {
text-align: right;
flex-basis: @min-width-personal-tools;
margin-left: @margin-horizontal-search;
// Support IE9: This is reset in @support query below if Flexbox is available.
float: right;
}
}
// If flexbox supported reset the floats that are supporting IE9
// When IE9 is no longer supported this entire query can be dropped.
@supports ( display: flex ) {
.skin-vector-search-header {
.mw-header {
flex-wrap: wrap;
}
#p-personal,
#p-search {
flex-grow: 1;
// Disable the float: left rule for IE9 support
float: none;
}
#mw-sidebar-button {
// Disable the float: left rule for IE9 support
float: none;
}
}
}