mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-11 16:59:09 +00:00
Add sticky header feature flag, query param, and class
Bug: T284463 Change-Id: I520832fa1e0a66bb24479e47c8e8f8011e514299
This commit is contained in:
parent
b0129f1d27
commit
46d98c90f4
|
@ -186,6 +186,26 @@ final class Constants {
|
|||
*/
|
||||
public const FEATURE_CONSOLIDATE_USER_LINKS = 'ConsolidateUserLinks';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const QUERY_PARAM_STICKY_HEADER = 'vectorstickyheader';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CONFIG_STICKY_HEADER = 'VectorStickyHeader';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const REQUIREMENT_STICKY_HEADER = 'StickyHeader';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const FEATURE_STICKY_HEADER = 'StickyHeader';
|
||||
|
||||
/**
|
||||
* The `mediawiki.searchSuggest` protocol piece of the SearchSatisfaction instrumention reads
|
||||
* the value of an element with the "data-search-loc" attribute and set the event's
|
||||
|
|
|
@ -397,6 +397,14 @@ class Hooks {
|
|||
$bodyAttrs['class'] .= ' skin-vector-consolidated-user-links';
|
||||
}
|
||||
|
||||
if (
|
||||
VectorServices::getFeatureManager()->isFeatureEnabled(
|
||||
Constants::FEATURE_STICKY_HEADER
|
||||
)
|
||||
) {
|
||||
$bodyAttrs['class'] .= ' skin-vector-sticky-header';
|
||||
}
|
||||
|
||||
$config = $sk->getConfig();
|
||||
// Should we disable the max-width styling?
|
||||
if ( !self::isSkinVersionLegacy() && $sk->getTitle() && self::shouldDisableMaxWidth(
|
||||
|
|
|
@ -144,6 +144,30 @@ return [
|
|||
$services->getStatsdDataFactory()->increment( $bucket );
|
||||
}
|
||||
|
||||
// Feature: Sticky header
|
||||
// ================================
|
||||
$featureManager->registerRequirement(
|
||||
new OverridableConfigRequirement(
|
||||
$services->getMainConfig(),
|
||||
$context->getUser(),
|
||||
$context->getRequest(),
|
||||
null,
|
||||
Constants::CONFIG_STICKY_HEADER,
|
||||
Constants::REQUIREMENT_STICKY_HEADER,
|
||||
Constants::QUERY_PARAM_STICKY_HEADER,
|
||||
null
|
||||
)
|
||||
);
|
||||
|
||||
$featureManager->registerFeature(
|
||||
Constants::FEATURE_STICKY_HEADER,
|
||||
[
|
||||
Constants::REQUIREMENT_FULLY_INITIALISED,
|
||||
Constants::REQUIREMENT_LATEST_SKIN_VERSION,
|
||||
Constants::REQUIREMENT_STICKY_HEADER
|
||||
]
|
||||
);
|
||||
|
||||
return $featureManager;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -165,6 +165,12 @@ body {
|
|||
.skin-vector-consolidated-user-links & {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.skin-vector-sticky-header & {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: @background-color-base;
|
||||
}
|
||||
}
|
||||
|
||||
/* Searchbox */
|
||||
|
|
|
@ -321,7 +321,14 @@
|
|||
"logged_in": false,
|
||||
"logged_out": false
|
||||
},
|
||||
"description": "@var array Moves the personal user links into a consolidated dropdown menu with the exception of the user page link. User page link moves out of personal menu into top level item next to notifications."
|
||||
"description": "@var array Moves user links into a consolidated dropdown menu with the exception of several top level items including echo, user page and create account links."
|
||||
},
|
||||
"VectorStickyHeader": {
|
||||
"value": {
|
||||
"logged_in": false,
|
||||
"logged_out": false
|
||||
},
|
||||
"description": "@var array Enables a persistent header that allows quick access to user links, editing tools, search and other links while scrolling down a page"
|
||||
},
|
||||
"VectorDisableSidebarPersistence": {
|
||||
"value": false,
|
||||
|
|
Loading…
Reference in a new issue