2021-08-30 22:44:00 +00:00
@import '../../common/variables.less';
2022-09-29 22:54:55 +00:00
@import '../../common/mixins.less';
2021-08-30 22:44:00 +00:00
@import 'mediawiki.mixins.less';
2022-11-04 19:25:19 +00:00
@spacing-search-title-divider: 30px;
2022-05-05 13:43:10 +00:00
@font-size-sticky-header-links: unit( 14 / @font-size-browser, em ); // Equals `0.875em`.
2023-03-28 17:45:48 +00:00
.vector-sticky-header-container {
2021-08-30 22:44:00 +00:00
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: @z-index-header;
2022-07-19 12:08:01 +00:00
border-bottom: @border-width-base @border-style-base @colorGray14;
2022-09-09 16:56:44 +00:00
// Hide sticky header until visible class is applied to the body
2023-03-28 17:45:48 +00:00
transition: @transition-sticky-header;
2022-09-09 16:56:44 +00:00
display: none;
transform: translateY( -100% );
opacity: 0;
2023-03-28 17:45:48 +00:00
}
.vector-sticky-header {
width: 100%;
height: @height-sticky-header;
display: flex;
align-items: center;
justify-content: space-between;
2021-08-30 22:44:00 +00:00
//
// Layout
//
2021-09-24 21:00:32 +00:00
&-start,
&-end,
&-icons,
2023-01-30 15:33:57 +00:00
&-buttons,
2021-09-24 21:00:32 +00:00
&-context-bar {
2021-08-30 22:44:00 +00:00
display: flex;
align-items: center;
}
2021-09-24 21:00:32 +00:00
&-start {
2022-02-14 19:06:33 +00:00
flex-grow: 1;
2022-02-03 20:29:41 +00:00
min-width: 0;
2021-08-30 22:44:00 +00:00
}
2022-09-09 16:22:07 +00:00
// Apply nowrap to title and buttons
// Must apply to &-ccontext-bar-primary rather than &-context-bar or &-start
// to avoid applying nowrap to the collapsed TOC menu
&-context-bar-primary,
&-end {
white-space: nowrap;
}
2021-08-30 22:44:00 +00:00
//
// Components
//
&-context-bar {
2022-07-19 12:08:01 +00:00
border-left: @border-width-base @border-style-base #c8c8c8;
2022-11-04 19:25:19 +00:00
padding-left: @spacing-search-title-divider;
2022-02-03 20:29:41 +00:00
min-width: 0;
2022-11-07 22:57:31 +00:00
margin-left: @spacing-search-title-divider;
2021-08-30 22:44:00 +00:00
}
&-context-bar-primary {
2021-09-14 21:10:46 +00:00
overflow: hidden;
2021-11-24 20:59:16 +00:00
font-family: @font-family-serif;
// T296320 closest standardized option to 22px (24px)
font-size: @font-size-heading-2;
2022-02-03 20:29:41 +00:00
text-overflow: ellipsis;
2022-02-19 00:14:15 +00:00
// T300134 Prevent text from wrapping in the sticky header.
wbr {
display: none;
}
2021-08-30 22:44:00 +00:00
}
2021-09-09 21:40:06 +00:00
2023-01-30 15:33:57 +00:00
&-end {
2022-05-05 13:43:10 +00:00
font-size: @font-size-sticky-header-links;
2023-01-30 15:33:57 +00:00
}
&-end,
&-icons,
&-buttons {
// Spacing between buttons
2022-11-18 17:03:47 +00:00
column-gap: 8px;
2022-05-05 13:43:10 +00:00
}
2023-01-30 15:33:57 +00:00
&-buttons > .mw-ui-quiet {
// All quiet buttons, even those with labels, should have 5px horizontal padding
// TODO: Move this fix upstream?
padding: 5px;
}
2021-09-09 21:40:06 +00:00
.vector-search-box {
// Hide the search box until the user toggles it.
display: none;
}
&.vector-header-search-toggled {
2022-02-01 20:52:16 +00:00
// .vector-sticky-header-search-toggle left border (1px) + left padding (12px)
// - .cdx-text-input__start-icon left offset (9px [1]) = 4px
// [1] see https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/text-input/TextInput.vue#257
2021-12-16 03:13:56 +00:00
@margin-start-search-box: 4px;
2022-02-01 20:52:16 +00:00
// .vector-sticky-header-search-toggle left border (1px) + left padding (12px)
// - .cdx-text-input__start-icon left offset (22px [2]) = -9px
// [2] see https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/typeahead-search/TypeaheadSearch.vue#708
@margin-start-search-box-with-thumbnail: -9px;
2021-12-16 03:13:56 +00:00
2021-09-09 21:40:06 +00:00
.vector-sticky-header-search-toggle,
.vector-sticky-header-context-bar {
display: none;
}
.vector-search-box {
display: block;
2021-12-16 03:13:56 +00:00
margin-left: @margin-start-search-box;
2021-09-09 21:40:06 +00:00
}
2021-12-16 03:13:56 +00:00
// T296318 Decrease the start margin of the search box to account for the
// icon's increased start position when the search component has thumbnails.
2021-09-09 21:40:06 +00:00
.vector-search-box-show-thumbnail {
2022-02-01 20:52:16 +00:00
margin-left: @margin-start-search-box-with-thumbnail;
2021-11-24 21:16:31 +00:00
2022-02-01 20:52:16 +00:00
.cdx-text-input__start-icon {
2021-11-24 21:16:31 +00:00
color: @colorGray2;
}
2021-09-09 21:40:06 +00:00
}
}
2021-08-30 22:44:00 +00:00
}
2021-09-03 15:55:50 +00:00
2022-09-09 16:56:44 +00:00
// T298836 Sticky header is only shown at higher resolutions
@media ( min-width: @min-width-desktop ) {
2021-09-28 22:43:15 +00:00
.client-js.vector-sticky-header-enabled {
2021-09-20 23:37:54 +00:00
// T290518: When the sticky header is enabled (feature flag is on, js is
// enabled, and viewport is at higher resolutions), add scroll padding to the
// root element. This is needed so that the sticky header does not overlap the
// top of an element when the URI has a hash fragment (e.g. when the user clicks
// a jump link) and when the user tabs through elements in reverse order.
//
// Please note that this class must be independent of the
// .vector-sticky-header-visible class to correctly handle situations where the
// sticky header isn't visible yet but we still need scroll padding applied
// (e.g. when the user navigates to a page with a hash fragment in the URI).
2023-02-28 19:48:31 +00:00
scroll-padding-top: ~'calc( @{height-sticky-header} + @{scroll-padding-top} )';
2021-09-20 23:37:54 +00:00
2023-03-28 17:45:48 +00:00
.vector-sticky-header-container {
2022-09-09 16:56:44 +00:00
// Sticky header is only enabled for js users and when feature flag is enabled
2023-03-28 17:45:48 +00:00
display: block;
2022-09-09 16:56:44 +00:00
}
2023-03-28 17:45:48 +00:00
.vector-sticky-header-visible .vector-sticky-header-container {
// Show sticky header with transition when visible class is applied to the body
opacity: @opacity-base;
transform: translateY( 0 );
2022-09-16 11:11:25 +00:00
}
2022-09-09 16:56:44 +00:00
2023-03-03 21:23:28 +00:00
// - T314330 `.vector-feature-toc-pinned-enabled #vector-toc-pinned-container`
2022-09-16 11:11:25 +00:00
// Prevent ToC from jumping when sticky header is enabled.
// - T289817 `.mw-sticky-header-element` provides an API for template developers
// to make their templates compatible with the Vector 2022 sticky header.
// @stable See the Integration notes for developers section at
// https://www.mediawiki.org/wiki/Reading/Web/Desktop_Improvements/Features/Sticky_Header
// - `.charts-stickyhead th` makes chart and table headers appear below the sticky header.
2023-02-16 23:55:58 +00:00
&.vector-feature-toc-pinned-enabled #vector-toc-pinned-container,
2023-02-04 02:01:56 +00:00
&.vector-feature-page-tools-pinned-enabled .vector-page-tools-landmark,
2022-09-16 11:11:25 +00:00
.mw-sticky-header-element,
.charts-stickyhead th {
/* stylelint-disable-next-line declaration-no-important */
top: @height-sticky-header !important;
2022-07-23 12:06:09 +00:00
}
2023-02-04 02:01:56 +00:00
#vector-toc-pinned-container .vector-toc,
#vector-page-tools-pinned-container .vector-page-tools {
max-height: ~'calc( 100vh - @{height-sticky-header} - @{max-height-bottom-spacing-scroll-indicator} )';
}
2021-09-28 22:43:15 +00:00
}
}