Commit Graph

463 Commits

Author SHA1 Message Date
Clare Ming 3dccc74b4b Add title attributes to menu icons on hover
- Add title attribute to Header template for hamburger icon.
- Override tooltip for user links menu icon for anon users.
- Make sure tooltips are empty for legacy version.
- Add translatable strings for new tooltip, title.

Bug: T287494
Change-Id: I84ce6a1eb2a37eb9ea71a40c565c059d156a44ba
2021-08-25 13:20:22 -06:00
TChin a841713f35 Replace deprecated CentralIdLookup::factory
Bug: T289713
Change-Id: Icba4d81d66a40012658172929ed4e015c074b903
2021-08-25 13:58:49 -04:00
jdlrobson 391d9ba509 [refactor] Clean up responsive handling
There is no need for this to be in the constructor. Separate into
its own function that inherits from parent class and existing parent
method isResponsive.

Change-Id: I60d155ec9db99ccfe0b74271dee76275a8a6986c
2021-08-23 15:59:15 +00:00
Sam Smith e6e2120099 Fix language treatment A/B test bucket counting
Register a temporary requirement that is configured the same as the
"LanguageInHeader" requirement. Pass that requirement a custom
configuration, in which the language treatment A/B test is always
enabled. Increment the bucket corresponding to whether the requirement
is met.

Supporting changes:

* Add a version to the base bucket name and set it to 2

Bug: T286932
Change-Id: Ic639687237074a13e7feb3c9084a35db0e5cb902
2021-08-09 19:48:38 +01:00
bwang 46d98c90f4 Add sticky header feature flag, query param, and class
Bug: T284463
Change-Id: I520832fa1e0a66bb24479e47c8e8f8011e514299
2021-08-04 18:49:56 +00:00
jenkins-bot 4974d7d595 Merge "Run Vector's SkinTemplateNavigation hook last" 2021-07-29 23:42:03 +00:00
jdlrobson d0c41d1dfc Run Vector's SkinTemplateNavigation hook last
Depends-On: Iec99be92378dc1a43f39428caffc03e1f594a927
Bug: T287533
Change-Id: I7d840d047627108a0a921ea52d5cb4bd06f36ab5
2021-07-29 14:27:28 +00:00
jenkins-bot 7ebd1ddc92 Merge "Remove duplicate login button from user links user menu." 2021-07-28 22:02:06 +00:00
Clare Ming 27996c496b Remove duplicate login button from user links user menu.
Bug: T287585
Change-Id: I8f040be7f76911ca05268981b270e2eb44b2ff96
2021-07-28 15:32:25 -06:00
Clare Ming f89a5b2d0b Add statsd counter for languages A/B test
Bug: T286932
Change-Id: I86ef358bfd5316e1f89fb1fde16f1cddade4d211
2021-07-28 13:26:45 -06:00
jenkins-bot 63dcfb720d Merge "Copy interwiki links into sidebar" 2021-07-27 21:21:20 +00:00
Nicholas Ray d8f62f780c User menu design tweaks
* Revises UserLinks.less according to the T285786 spec.

* Unsets 'createaccount' data in $content_navigation in favor creating
this link inside SkinVector which follows the same pattern as the Login
link. This is needed because the create account link needs to be on top
of the login link in the menu per T285786#7231671.

* Changes MenuDropdown.less to pad the anchor element instead of the li
element. This results in a more intuitive click target.

* Places an end margin on the search box to add space between the user
links and the search box.

Bug: T285786
Change-Id: Idb860e6b65c9f266a8027e3f486ccf4c4ec4ed3c
2021-07-27 14:25:32 -06:00
bwang a27b6f7096 Copy interwiki links into sidebar
Bug: T287206
Change-Id: I951b2a277f9484f8e2735951d85c0766098607b5
2021-07-27 12:08:11 -05:00
libraryupgrader 8dc9511bbc build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)
* prismjs: 1.23.0 → 1.24.1
  * https://npmjs.com/advisories/1762 (CVE-2021-32723)

Change-Id: Ief0fe110b6746c209085502cf4639429a4116ab5
2021-07-24 01:35:45 +00:00
jdlrobson f66cc87898 Removes additional space between language button label and icon
Caused by whitespace in HTML

Addresses topic 2 from Alex's feedback in:
T191021#7228591

Bug: T191021
Change-Id: I32de25d4f4927c2ea8059b972a55b79a94691e76
2021-07-21 21:50:10 +00:00
jdlrobson 13de4ff225 Prepare for updated mw-ui-icon implementation in Vector
We will couple the roll out of the consolidated user links code
with the roll out of the new icon styles.

This change is restricted to the user links feature and will result
in some slight UI discrepencies until
Ibc136a17662ae839f90babb21e0f7e8f27b7a7d5
is merged.

Bug: T191021
Change-Id: Ia2d2c86e61341b9900f9ac337ddd763252e0515f
2021-07-20 18:52:40 +00:00
ZabeMath e7fbb01aca Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: If867b4f97918db581d337a32b33cbca2315a71f6
2021-07-18 13:48:44 +02:00
jenkins-bot 2e5ecae6d2 Merge "Consolidate user links outside of the user menu dropdown into a single new menu" 2021-07-15 20:48:37 +00:00
jdlrobson 276738b620 Consolidate user links outside of the user menu dropdown into a single new menu
- Adds UserLinks__more template to process the list of user links.
- Simplifies styles in UserLinks.less, and namespace them under .vector-user-menu-more
- Add i18n for the label of the new navigation menu
- Update storybook and typing

Bug: T284584
Change-Id: I92290815869dcb939f01d9aff4aa202f6f004894
2021-07-15 20:27:54 +00:00
jenkins-bot 73fd6c0290 Merge "Add querystring parameter override for user links, language in header." 2021-07-15 19:26:35 +00:00
Clare Ming cb3d5742da Add querystring parameter override for user links, language in header.
- Add new OverridableConfigRequirement class.
- Add query parameter constant for user links.
- Update Feature Manager with new requirements.
- Use new class for LanguageInHeader requirement.
- Remove LanguageInHeaderTreatmentRequirement class and test.
- Add unit test to cover user links and language in header.

Bug: T285855
Change-Id: I56b729a9e245ed2ddc85625c0be39f5c26320ac4
2021-07-15 16:51:48 +00:00
Clare Ming 19173ea296 Move userpage link to precede notifications
Update user links template to reshuffle order.

Bug: T285728
Change-Id: Ie33a513a9a72e9d659d04a76bb38d8fb1977fb19
2021-07-12 13:06:18 -06:00
jdlrobson 3dffee277c Refactor the way we add classes to list items
Append mw-ui-icon classes to list item not list link
This allows us to apply a custom padding separate from the icon.

Note due to a bug in how core handles personal user items,
this will result in the icons temporarily disappearing for several
items until If399dfff9bbdd3b03b2ca702face3ec5164bef11 is resolved.
This is okay given the user menu is currently feature flagged.

Bug: T191021
Change-Id: I766aeb4d1bb36cebd0d80ad43ced940dbea96477
2021-07-01 14:25:46 -07:00
bwang 0a75e2e627 Ensure userAvatar icon is only used in logged in users
Additional change: A bundlesize increase is required given
recent developments in the user menu.

Bug: T284748
Change-Id: I2b0981d621c3add42731e50d5aef299b32548b4a
2021-06-30 22:41:47 +00:00
jenkins-bot 6597bc7d86 Merge "Collapse header at lower resolutions" 2021-06-30 22:11:34 +00:00
jdlrobson 6777c5b1fe Collapse header at lower resolutions
Reduces the min-width to 340px with several changes at lower
resolutions
* collapses create account into dropdown
* hides language button and user messages
* The search component is updated to include a search toggle which
can be used to hide and show the search input at lower resolutions
- this leads to a slight HTML change with caching implications,
it also moves away from a BEM usage which is not standard for this
repository.
* limits width of logo based on the dimensions we display
in mobile

Bug: T276566
Change-Id: I89d75843ca7e33e6de93af5d7c22e46b7249c4b7
2021-06-30 21:43:35 +00:00
jenkins-bot 91aeef476d Merge "search: Disable query highlight for some languages" 2021-06-30 21:01:01 +00:00
Sam Smith 445ba883a2 search: Disable query highlight for some languages
Following on from I551414b1, disable query highlighting for the list of
languages provided by @TJones in T281797.

The user's interface language can be different from the wiki's content
language and so the former is not available at configuration time. Thus,
we fetch the user's interface language at request time. Fortunately,
@TJones' list of languages is small so there should be little
perceivable performance impact from the perpective of the user.

Additional changes:

- Remove the config.VectorWvuiSearchOptions.value.highlightQuery
  property from skin.json

Bug: T281797
Change-Id: Ib39736a93fa64e82253f88551d125413e672558b
2021-06-30 16:47:46 +01:00
jdlrobson 62d0cf8d92 Dropdown toggles trigger click tracking instrumentation
Bug: T284542
Change-Id: Ib019c616bc53ebab50ed9eeef05b6d9712958f38
2021-06-24 23:08:19 +00:00
jenkins-bot b8545c4b5e Merge "Remove whitespace from page title template" 2021-06-24 22:16:07 +00:00
bwang 9dc295945c Remove whitespace from page title template
Bug: T282318
Change-Id: Idd36ad20545e04706bbc9bfa034c65fc0d6bba16
2021-06-24 16:47:31 +00:00
Nicholas Ray b82ecc2173 Remove SkinVector::ICON_USER_LINK_MAP usage
Per T284594, we are now setting the icon key/value when the relevant
menu item is created (e.g see I95f2a0a01134f2c3dfc22083be66c99de26b530f
) to allow for easier reuse of icons across skins.

Additionally:

* Refactor SkinVector to pull the appropriate login/logout icon from
core instead of setting this in Vector

Bug: T284594
Depends-On: I95f2a0a01134f2c3dfc22083be66c99de26b530f
Depends-On: I6292de50c3940f39b0084a2af4f79af78583720f
Change-Id: I02163645937de4b8a2c4375f29851c29462a582d
2021-06-23 18:33:17 +00:00
Clare Ming d9f4c51b4e Add icon prefix to login link
Add classes to prefix login link with login icon.

Bug: T276562
Change-Id: I2b188a25986a717436af223a469b05c95e5b2d88
2021-06-22 09:18:06 -06:00
jenkins-bot 45598d0ec3 Merge "Update user menu icon and storybook" 2021-06-21 14:42:26 +00:00
jenkins-bot 30eb4196b9 Merge "Skin: Convert number of languages to interface language" 2021-06-21 14:22:40 +00:00
bwang 8389de9cb9 Update user menu icon and storybook
Bug: T284748
Change-Id: Icdbfd882490b380871befd3c6606c4b48d225132
2021-06-18 20:30:55 +00:00
Sam Smith 78929d58da Skin: Convert number of languages to interface language
Bug: T283955
Change-Id: Ic601cf94907bdec329021a48101da13a979af106
2021-06-18 17:18:52 +00:00
bwang 22e343eecb Ensure login button is only rendered for anon users
Bug: T276561
Change-Id: I0f4fa94b4caacc45b299d7518523aa906ff65849
2021-06-16 14:01:06 -05:00
Jan Drewniak c26ae0f965 Move "logout" button to bottom of user links menu in modern Vector
For modern Vector, removes the logout link in the user menu and places it
below that menu by appending it to the html-after-portal property of the
skin data.

Also modifies the `.vector-user-menu-login` style to accommodate both the
login and logout button.

bug: T281791
Depends-On: If82a736e37174aaadd0ff07019a1fae3759a9e51
Change-Id: I7675230e09a50eaeab448182329f850ad2689514
2021-06-14 23:40:19 +02:00
bwang 34344adbf5 Remove UserMenu and use Menu template instead
- Adds html-before-portlet to Menu.mustache
- Removes UserMenu.mustache and type def
- Factors out getCreateAccountHTML and getLoginHTML for generating HTML used in Menu
- Scopes UserLink template data under "data-vector-user-links"

Follow up to: 298f945983
Bug: T284584
Change-Id: I91104eb7c4fd12756e770561666f4c9a64da57d6
2021-06-11 09:41:58 -05:00
jenkins-bot 320b7708f4 Merge "Prefix user links menu items with icons" 2021-06-08 14:35:57 +00:00
Clare Ming b80d97b1e8 Prefix user links menu items with icons
- Add logic in Vector hooks to prefix user menu links with icons.
- Add method for getting icon name based on user menu key.
- Add constant to map user menu keys to associated icon references.
- Include icon treatment for both logged in/out users.

Bug: T276562
Change-Id: Ia69366eb4fbd50b48fe5513ef99048bdc5df64fb
2021-06-07 18:10:54 -06:00
Clare Ming 06d0afbcb3 Update styles for user-interface-preferences in user links menu.
- Add new menu to UserLinks template.
- Fix styles for user links toolbar.

Bug: T282196
Change-Id: I42d6e6e11d76b2d25b2720a617f2fb2e545eb4b6
2021-06-05 02:01:17 +00:00
bwang b5aa055900 Update UserLinks styles to use classes instead of ids
Follow up to: 298f945983

Change-Id: I5bc28501d0ae4c2597796dbf1ed9c10eacadad62
2021-06-02 22:16:59 +00:00
bwang 298f945983 Create new user menu template for consolidated user links in logged out users
- Adds mustache template for the new user menu
- Uses new functions for getting user link data that have been factored out of SkinTemplate in the dependent patch
- Refactor new user menu styles to be namespaced inside UserMenu.less

Notes:
- Originally this patch included more storybook changes, but I removed them in favor of this follow up patch: 696651

Bug: T276564
Depends-On: Ia841f92c626ca32a9ad437b3d1cff78309c83ed8
Change-Id: Ib15752428265fdc06a3000f62bdca44c67648974
2021-06-02 09:23:22 -05:00
jdlrobson 6300923601 Storybook should include UserLinks
Merge UserMenu into UserLinks for legacy and modern
Add a story for the UserLinks menu

Fixes: rendering of Skin (legacy) personal tools (the user icon
no longer overlaps)

Change-Id: I491ebb3962780bf2cf7f1dfb4dd09d576c294366
2021-05-27 19:27:27 +00:00
jenkins-bot 1c3a214b24 Merge "Refactor: Create UserLinks component" 2021-05-25 18:49:47 +00:00
jdlrobson 96bf1e8276 Refactor: Create UserLinks component
Have a single template for the UserLinks component, with a single
element wrapping all its subcomponents as discussed.

Change-Id: I35936a6fa1ba335639ca3f47fd439a3662268fca
2021-05-25 16:57:35 +00:00
jenkins-bot d7e22f7f20 Merge "Use escaped() instead of parse() in SkinVector::createULSLanguageButton" 2021-05-24 16:02:39 +00:00
Jan Drewniak 7258a7cb86 Use escaped() instead of parse() in SkinVector::createULSLanguageButton
Bug: T282540
Change-Id: Ie8f0fe262f34e669d49f98efc27c179b257786dc
2021-05-24 14:07:25 +02:00
jdlrobson 3306124038 Introduce the vector-body class
This follows up I4c1b15d90bacbc9b13782a1d8f52e838ce8ecd83
In that change, a new class for Vector specific styles should have
been added and the existing CSS referenced. I could have sworn I did
this, but obviously not (perhaps a git rebase or unstage change problem).
We did it for the other skins e.g. Monobook (I90d85c21f4a62e6697f24e3ce388445a0a53c2b0)
but evidently not Vector.

We also have to worry about cached HTML now, the #bodyContent is
the most reliable selector to use for before and after
I4c1b15d90bacbc9b13782a1d8f52e838ce8ecd83

Additional:
Remove the mixin-clearfix rule on bodyContent - this is now
redundant with the changes in T279388 and should have been
removed.

Bug: T283206
Change-Id: I15103cea72c793589a03ab1a3e7f3b377acb287f
2021-05-21 13:50:31 -07:00
jenkins-bot 81947cbd67 Merge "Remove unused $contentNavigation from `getTemplateData` method" 2021-05-14 20:20:54 +00:00
Nicholas Ray 7ab2edb2fa Remove unused $contentNavigation from `getTemplateData` method
This is not used in the method and, from the surface, appears to be
extraneous.

Change-Id: I63b1eba54f8ce11296c187b292010e415a2915af
2021-05-14 12:13:14 -06:00
jdlrobson 6998c536d4 Both UserMenu stylesheets should be shipped in modern
Since we have feature flagged the new user menu feature, it is
imperative we load both sets of styles until the feature has
shipped. This allows us to switch seamlessly between the two
without worrying about cached HTML being served with updated CSS.

To do this, we add a new class to both user menu's distinguishing
the legacy version from the modern version. The styles are then
scoped to these new selectors.

This also fixes some regressions with the legacy user menu in
modern Vector when wgVectorConsolidateUserLinks is disabled.

Notes:
* No caching selector is needed for #pt-userpage given it can only
ever be output for logged in users.
* ID selectors in general are bad, so scoping to mw-portlet-personal-user-menu-legacy
isolates the legacy component allowing it to be rendered alongside the modern UserMenu

Bug: T276561
Change-Id: I068c5233bb25a7b141e66a6726b5761841f83eb2
2021-05-14 10:13:09 -07:00
Jdlrobson efaf3aadf3 Remove mw-body-content from HTML that is not the article body
The `mw-body-content` class is currently decorating various things,
however should be limited to the body of the article. This allows
us to identify the wrapping element without resorting to a selector
that makes use of an identifier and to separate styling concerns of
UI (indicators and site notice) from article content.

Bug: T279388
Change-Id: I4c1b15d90bacbc9b13782a1d8f52e838ce8ecd83
2021-05-14 00:01:52 +00:00
Nicholas Ray de5a640c0b Allow `languageinheader` query param to fully control treatment of languages
Before this commit the `languageinheader` query param would only take
effect if the A/B test was enabled AND the query param was set. Per
T282543, we want the query param to take effect regardless of the state
of the language/AB test config.

To see new treatment, set `languageinheader=1`.
To see old treatment, set `languageinheader=0`.

Bug: T282543
Change-Id: I6a06e90b6e46a6fd7506a5ddeaf071b893ebfe8e
2021-05-13 12:04:12 -06:00
jenkins-bot b41e224ec6 Merge "Refactor: Renaming mustache variable `page-isarticle` to `is-article`" 2021-05-10 09:38:08 +00:00
Jan Drewniak c22dc8d95b Refactor: Renaming mustache variable `page-isarticle` to `is-article`
Modifies this variable name to use proper hyphen-case and
prioritizes the type of variable rather than it's source.

This prioritization makes sense in Mustache templates because the
variable is a boolean and is used exclusively in if statements,
e.g. {{#is-article}} ... {{/is-article}}

Change-Id: I72e9baf0a979d922b8217aabe8cf0c40699f891b
2021-05-10 08:55:06 +00:00
jdlrobson e7a4ecf9db Refactor: Clarify functions that return booleans and template booleans
We prefix templates that are booleans with "is-" and tend to prefix
functions that return booleans with "if" or "should"

This renames the new "shouldConsolidateLinks" method.

Follow up to I1c305d89bece147a6f1b478441119c3169abfbdd

Change-Id: I6a5908b8b35ca6bceec8b864e3ac651fc7e8ced8
2021-05-06 23:51:56 +00:00
Clare Ming dc0b679bfa Consolidate user links into personal dropdown menu for logged users.
Pull personal menu items except for user page link into a consolidated dropdown menu based on feature flag using Vector hooks. Add consolidate user links feature flag for logged in/out users. Update styles for personal toolbar. Add logic to template to show legacy toolbar or consolidated toolbar based on feature flag variables.

Bug: T276561
Depends-On: If4e143aada711d210ae45d33b97a6be0685b6a41
Change-Id: I1c305d89bece147a6f1b478441119c3169abfbdd
2021-05-06 12:49:39 -07:00
jenkins-bot bea00bc290 Merge "Create A/B test harness for Language in header feature" 2021-05-05 17:33:38 +00:00
jenkins-bot 888e17bd47 Merge "Place language button near bottom of Main page." 2021-05-05 17:08:18 +00:00
Jan Drewniak 80d734b4d2 Place language button near bottom of Main page.
In modern Vector, the language button that is placed inside
the page header should appear near the footer, if the page is a
Main page.

This changes some CSS selectors to not depend on the language
button having the `.mw-body-header` parent element.

Bug: T276140
Change-Id: I97bf0c11d0321752d472ac4988618a1db92b7271
2021-05-05 13:42:19 +02:00
Nicholas Ray 49f2b25737 Create A/B test harness for Language in header feature
* Adds ab test config to enable/disable the ab test. Defaults to `false`
(ab test disabled).

* Adds a `languageinheader` query param which only takes effect when the
ab test is enabled. The query param is cast to a bool and determines
which treatment is shown. For example, set query param to
`languageinheader=1` to see the new treatment. Set query param to
`languageinheader=0` to see the old treatment. To bucket based on the
user's id or global user's id, don't set the query param.

* Moves the language in header config work that was previously in
ServiceWiring into a `LanguageInHeaderTreatmentRequirement` class so
that unit tests can be done on most of the logic that determines whether
the language in header will show.

* Adds logic to bucket user based on [global] user id.

Bug: T280825
Change-Id: Id538fe6e09002fae6c371109769f3b7d61e7ac6d
2021-05-04 14:41:53 -06:00
libraryupgrader 932c8d541e build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Ib71722afb42c300ec3d6a3cd3bfab7eddde18bdf
2021-05-04 12:41:27 +00:00
Sam Smith 5998d82056 templates: Remove role deprecation HTML comments
Sending these comments to all users incurs small performance penalty on
both sides. Further, the intended audience for the comments is
vanishingly small when compared to all users and we have more direct
avenues to contact that audience, i.e. the Technical Village Pump.

Remove the HTML comments related to the deprecation of the
role="navigation|main" attributes on the navigation and main elements.

Bug: T281025
Change-Id: I4735c435fc31c5ba4fbf99e9d9bf12adc466b02f
2021-04-30 15:44:52 +01:00
Nicholas Ray 2ff3308ac4 Remove 'noexternallanglinks' check from `canHaveLanguages`
`noexternallanglinks` is a magic word that can be used to
suppress/modify the languages produced by wikibase [1]. Most importantly
though, languages can still appear even with the usage of this magic
word. Therefore, this check can be removed.

[1] https://www.mediawiki.org/wiki/Wikibase/Installation/Advanced_configuration#noexternallanglinks

Bug: T277517
Change-Id: I1f532b3e669564f570b47451693ddb15757a6101
2021-04-21 10:45:06 -06:00
Clare Ming 8cab50874c Add config for language in header for logged in/out users
Register updated requirement for language in header for logged in and logged out users in Vector's ServiceWiring file. Make VectorLanguageInHeader backwards compatible to handle boolean values when registering LanguageInHeader feature. Update VectorLanguageInHeader variable to array in config to handle different logged states.

Bug: T277588
Change-Id: I37a3a01e83f051cf0679769c8b9b5b41f00d6d72
2021-04-16 10:38:28 -06:00
jenkins-bot d6b7ef0a8e Merge "Hide languages-in-header button when no additional languages" 2021-03-30 18:23:55 +00:00
Jan Drewniak 980c8453ce Hide languages-in-header button when no additional languages
Hides the languages-in-header feature if there is only one
available language.
Also factors the additional classes required for the language
button into a separate function.

Note: Hiding the language button is a temporary solution
until T275147 is resolved.

Bug: T276950
Change-Id: I241abc6061bba12a6a209074fa4c2d2c89cea930
2021-03-29 23:07:26 +00:00
Ammarpad b7bf9a88a3 Use content-parser-output RL SkinModule feature
Require MW 1.36

Bug: T277218
Depends-On: I52f752aa782b09a51e2165300cc75d0e47fa3351
Change-Id: Ia1eec412111e8f6af3b45affdc186d9eafd4262c
2021-03-25 17:34:28 +00:00
jdlrobson 0d2e38375c Languages should not appear in side bar on modern Vector special pages
Follow up to 52edeee

Bug: T273144
Change-Id: I22b33d2090dcd814658ecc2f155d86a5b1791fc3
2021-03-03 22:48:00 +00:00
jenkins-bot 175723f2e5 Merge "Disable language button on certain pages" 2021-03-02 08:04:34 +00:00
jdlrobson 8d8e2d85e6 Language button is quiet with focus, active and hover states
* Add mediawiki ui button styles to Vector and convert language
button to a quiet button
* Restore the arrow for language button with ULS
* Vertically align button to first line of header
* Add a storybook entry for LanguageButton

Additional changes:
* Fix issues revealed by storybook - menu dropdown should
reset generic typography rule for `ul` tags
* Allow quotes usage in storybook without disable rule

Bug: T268241
Change-Id: I483350084fb46a51c50af6aab78c62db6d02df89
2021-03-01 20:01:45 +00:00
jdlrobson 52edeeea1c Disable language button on certain pages
The logic is based on the existing logic for the "Add language links"
however with the additional constraint that the page is not a special
page.

To avoid multiple expensive calls to getLanguages method,
the getLanguagesCached method is introduced.

Bug: T273144
Change-Id: I1085efca1e10c9b6f1305c2238664e0b2ec69123
2021-03-01 18:03:26 +00:00
jdlrobson 4035d3575f Move resource loader definition to skin.json
Now `wvui` is in core, there is no need for this to be conditional.

Depends-On: I91db16946e7ea46f69a6b57b116962f77ce3cd20
Change-Id: Icceaefc63d227ca772a986ad2c6ce28cbdb0a7d6
2021-02-12 01:49:21 +00:00
jdlrobson 68b989efb6 Simplify responsive Vector implementation
Vector has a wgVectorResponsive flag. This adds a ResourceLoader
module as well

I propose the configuration is repurposed to disable the min-width
on Vector and enable the viewport tag. This will allow us to use
test.wikipedia.org to test Vector at lower resolutions in future
as well as provide a suitable option for 3rd parties wanting to run
a responsive version of Vector that can be opted into using:

```
$wgVectorResponsive = true;
$wgVectorDefaultSkinVersion = '2';

```

As part of this change, the default skin version is set to 2, in
preparation for the next MediaWiki release. Note on Wikimedia wikis we
explicitly set this version so this will not impact any of our deployed
wikis.

Bug: T242772
Change-Id: I878920f49d18c5d60efd3ac45dc7912d2c62086e
2021-02-10 13:05:14 +00:00
Nicholas Ray e3abac06a6 Add mw-interlanguage-selector class to language button & hide menu/arrow when appropriate
* We add the `.mw-interlanguage-selector` class to the
.vector-menu-heading in the server rendered HTML. `ext.uls.interface.js`
later attaches a click handler to this selector that loads the rest of
ULS.

* We hide the dropdown arrow for js users and only show it again if
ext.uls.interface module isn't installed or is not being loaded.

* When the `ext.uls.interface` module has been loaded, we hide the checkbox
and checkbox hack menu in favor of showing the ULS popover.

Additionally:

* Adds '.vector-menu-heading' class to menu headings.

* Change h3 selector to `.vector-menu-heading`.

Bug: T273232
Change-Id: I6f4572c16ca4096dcda3aac4d585003b93dcccfa
2021-02-05 15:03:07 -07:00
jdlrobson 36eda30e0f Language button should use a new id to identify itself
This breaks existing integrations with extensions which will need
to be revisited as part of this redesign.

Change-Id: Iabf627e6926d4574f27448400d76210386ebdaa2
2021-02-04 20:27:13 +00:00
jenkins-bot 0c330185b1 Merge "Add language icon to language button" 2021-02-04 04:03:32 +00:00
jenkins-bot 497b0aad8a Merge "The label of the language button refers to the number of languages" 2021-02-04 02:59:48 +00:00
Jan Drewniak 5014c17570 Place indicators under page title
Fixes error in 03d61e12, indicators should be placed below
page title.

Bug: T248761
Change-Id: I61dcef0567373f28fd479b21ffa940a6e223ac16
2021-02-03 23:19:30 +01:00
jdlrobson f083eb2716 Add language icon to language button
The sidebar currently uses mw-ui-icon so we continue this
practice, however we provide a general rule to ensure all icons
rendered through it default to 20x20. This didn't impact the side
bar icon as that already specifies a height of 20px.

Bug: T268241
Change-Id: I6f8e8400da048a97cbf59c3e6ad918763fc91041
2021-02-03 15:38:30 +00:00
jdlrobson ef0ab0724e The label of the language button refers to the number of languages
Instead of "In another language" the button label will be
"0 languages", "1 language" or "X languages"

Bug: T268241
Change-Id: I293a1d5f4885f76cc5f62169ee24b52c234f9229
2021-02-03 15:34:43 +00:00
jenkins-bot 625c4bd099 Merge "Move #mw-panel into #mw-navigation" 2021-01-27 21:26:31 +00:00
Nicholas Ray 16b34aa750 Move #mw-panel into #mw-navigation
Not only might this make more sense from an accessibility standpoint
(because sidebar is also part of navigation and there is a heading with
that name), but it should also hide the sidebar when printing as there
are core styles that hide #mw-navigation.

[1] 3b381b71e9/resources/src/mediawiki.skinning/commonPrint.css (L31)

Bug: T265217
Change-Id: I7f936defa177ba172e4253ee6450040ffa52e257
2021-01-26 19:31:43 -07:00
Nicholas Ray 1e7ed6b2e1 Make expanding search input dependent on $wgVectorWvuiSearchOptions
Per T270202#6767750 the input should expand when focused before WVUI
loads. However, the input should *only* expand when `showThumbnail` is
`true` in `$wgVectorWvuiSearchOptions` to match how its done in WVUI
where it takes into account the size of the thumbnails. When
`showThumbnail` is false, it should not expand as the input won't match
WVUI and the WVUI load transition will be jarring.

To test locally, toggle between true/false in your LocalSettings.php:

```
$wgVectorWvuiSearchOptions = [
  "showThumbnail" => false,
];
```
Bug: T270202
Change-Id: I70277c1082a504fbd5f6023e9873e8071de7e35d
2021-01-26 17:37:22 -07:00
Nicholas Ray 8c76a17e43 Move Wvui Search A/B Logic to FeatureManager
FeatureManager allows the logic to be centralized and allows clients to
ask about its state. For instance, SkinVector will make use of it in
I70277c1082a504fbd5f6023e9873e8071de7e35d.

Also:

* Adds WvuiSearchTreatmentRequirementTest to test A/B logic

WvuiSearchTreatmentRequirement/Test logic are adapted from
I878239a85ffbecb5e78d73aed5568c56dbd7d659.

Bug: T270202
Change-Id: Ia02349a7b41c7caf26fbd728e0be7d47488b97e5
2021-01-26 17:36:37 -07:00
Nicholas Ray 2789e27a29 Correct config comment
`VectorUseCoreSearch` was changed to `VectorUseWvuiSearch` in
I3a063e0b085765ea1db3c4478fb30c11b0942b75.

Change-Id: Icc9f944ea695999133293bc9e90ac0818f746191
2021-01-26 13:59:41 -07:00
Sam Smith 746315bb5b Add search widget treatment A/B test
If the VectorSearchTreatmentABTest config variable is truthy and the
user is loged in, then pick the Core treatment (defined in the
mediawiki.searchSuggest RL module) or Vector's Vue.js-based treatment of
the search widget based on their user ID. If not, then fall back to
picking the treatment based on VectorUseWvuiSearch.

Supporting changes:

* Update initSearchLoader() in skins.vector.js/searchLoader.js to check
  whether the body.skin-vector-search-vue exists

* Remove wgVectorUseWvuiSearch from the skins.vector.js RL module's config

* Update the performance-related metrics collection to check which
  module is being loaded rather that use the above

Bug: T261647
Change-Id: Idc978392f5db14f0ae2b06ade0175fe534f4ae70
2021-01-26 12:02:01 +00:00
jenkins-bot 93578b0d77 Merge "Create .mw-body-header element for body content" 2021-01-26 02:56:20 +00:00
Jan Drewniak 03d61e12c9 Create .mw-body-header element for body content
For language-in-header feature, edits the <header> element to
contain:
- page title,
- language selector
- tagline (siteSub)
- Indicators

These elements are associated with header/meta content so grouping
them inside one header element makes sense semantically.

Bug: T248761
Change-Id: Ief6c4936d1ebe381432369f8d86419da5f7c6cae
2021-01-25 23:57:47 +01:00
jenkins-bot 27ad6eab12 Merge "Rename `wgVectorUseCoreSearch` to `wgVectorUseWvuiSearch`" 2021-01-25 22:47:49 +00:00
jenkins-bot 162cf8449d Merge "Languages can be moved out of sidebar" 2021-01-25 22:38:12 +00:00
Nicholas Ray 53f49c5c64 Rename `wgVectorUseCoreSearch` to `wgVectorUseWvuiSearch`
This allows better compatibility with FeatureManager (e.g. can use
requirements such as REQUIREMENT_LATEST_SKIN_VERSION). It will become
especially useful in I70277c1082a504fbd5f6023e9873e8071de7e35d and when
A/B testing search.

Bug: T270202
Change-Id: I3a063e0b085765ea1db3c4478fb30c11b0942b75
2021-01-22 16:25:46 -07:00
jdlrobson 355b188db4 Languages can be moved out of sidebar
A new config flag wgVectorLanguageInHeader is added to allow
us to render languages in sidebar or outside sidebar, in the
header.

it defaults to false to allow for further development and to
not disrupt the status quo.

To accomodate the new menu, a new header is added based on the design
in Minerva to contain the heading and language button. The language
button is floated to the right.

The new menu is not styled. That exercise is left for the follow up
task T268241

No caching implications of this change, as legacy and modern
experiences remain touched without changing the default value of the
new config flag

Bug: T260738
Change-Id: I5af1522cac3831c1c833388461fe254c03191f65
2021-01-22 09:10:49 -08:00
jenkins-bot 87dfbda424 Merge "Usages of page-langcode dropped for html-user-language-attributes" 2021-01-21 22:33:04 +00:00
jenkins-bot 0867954219 Merge "Allow more control over the max-width rules" 2021-01-21 19:27:10 +00:00
jdlrobson 05dc15954d Allow more control over the max-width rules
Bug: T260091
Change-Id: Ie534b0c34e240c588a4cc330898531f1d12df1f0
2021-01-21 18:51:12 +00:00
Raymond a002c3aeae Add missing / for self-closing input element
Consistency tweak, all other input elements do have the /

Bug: T272597
Change-Id: I9a4b44dda928a071634edcbea5cef2f19eef8881
2021-01-21 14:46:45 +01:00
jdlrobson 68b52a77e2 Usages of page-langcode dropped for html-user-language-attributes
html-user-language-attributes contains not only the lang attribute
but also the direction. There doesn't seem any value in regenerating
just lang attribute

Change-Id: I93e8081be1e81adf16d40bff54f0cc22c7155dd7
2021-01-20 16:13:12 -08:00
Isarra 538ccb24d8 Use {{link-mainpage}} in legacy sidebar same as new logo
Bug: T271873
Change-Id: I370d2ddfb233f882929f4d79ee4cfc690576ed85
2021-01-13 00:29:58 +00:00
jdlrobson d1fa2e6090 Fix template references
Seems less risky to fix this rather than revert, given a revert will
just mean more risk when we do it again, especially if the codebase
changes again and future manual rebases fail.

Bug: T271364
Change-Id: I7f63d6f07b6b715a9f31c83d572814da33ff2796
2021-01-06 13:56:01 -08:00
jdlrobson 9f1a1fa829 Simplify menu code
SkinMustache in core provides most of what is required for Vector to
generate its menus.  In the interest of having a canonical source of
truth for menus across all skins, Vector should use this data.

To ensure the HTML generated is (mostly) the same after this patch to
prior, a few modifications are necessary:

* The data from core is decorated so that Vector can continue having its
  own custom class names on menus. This is done using the
  decoratePortletClass method.
* There is no support for a menu having a header representing the
  selected menu item, as is currently the case with variants. This is
  achieved via an extension to getPortletData. It's assumed that later
  when variants are merged with languages, this can be removed.
* Menus are agnostic to how they are displayed, so we must continue to
  add the is-dropdown template variable to drop down menus. In future we
  may want to rethink our Menu partial to make this unnecessary in PHP.
* The portal-first class is redundant in the modern Vector as we can
  use the first-child selector. Previously we introduced a class to
  service the legacy skin where this rule doesn't apply as #p-logo is
  the first child.  However, the legacy skin can do this using a special
  next sibling selector instead.

Bug: T268157
Change-Id: I5f7adc1840441b508ffee40139b85b64021789e6
2021-01-04 19:02:34 +00:00
jenkins-bot c07310165a Merge "Use User->isRegistered(), not deprecated isLoggedIn()" 2020-12-19 17:06:44 +00:00
James D. Forrester 5ef1ddb733 Use User->isRegistered(), not deprecated isLoggedIn()
Bug: T270450
Change-Id: If385757d64664eba148914063fbbe88f72b66fdc
2020-12-19 16:44:06 +00:00
Umherirrender c643250755 Add missing @return to Requirement
even with type hint there should be the full phpdoc to be consistent

Change-Id: I74f2fec23d655deee5704b0ab432cba5c7921ab6
2020-12-18 22:55:08 +01:00
jenkins-bot a9b47f57fb Merge "Development: Allow us to test search with different API hosts" 2020-12-09 00:14:43 +00:00
Sam Smith aa10668e6d [search] Instrument Vue.js-based search widget
Add event listeners and associated helpers to emit SearchSatisfaction
events via the `mediawiki.searchSuggest` protocol.

Bug: T257698
Change-Id: Ica040cd18d6c4bf8a1b1f607bb4647c7e8eb7108
2020-12-08 23:41:19 +00:00
jdlrobson dce24c9784 Development: Allow us to test search with different API hosts
By default the API uses location.host as the host, however during
development it is useful to test against production wikis

For example to test against English Wikipedia:
$wgVectorSearchHost = 'en.wikipedia.org';

Note: Links when clicked will not take the user to the target page, and
instead will take the user to the search results page with a link to
create the page.

The following config can be used to workaround that page:
$wgDisableTextSearch = true;
$wgSearchForwardUrl = "/w/index.php?title=$1";

Change-Id: I5fbac7f54844d7a9d6976007bc0d0ff9938b9f2b
2020-12-08 15:22:45 -08:00
jdlrobson a52da8ddaa Cleanup: Drop unused body feature classes
These are no longer referenced in the code and artifacts of a time
when these were feature flagged.

Change-Id: Ia850ac9fb92033d82a333836ba7ff32312f042a7
2020-12-08 13:29:06 -08:00
Nicholas Ray e0c47dc462 Add Wvui Config to show/hide thumbnails and descriptions
Uses ResourceLoader's virtual config feature to get the config and pass
it down to Wvui's typeahead search component.

Disclaimer: I'm a typescript noob and am not sure if the
config.json.d.ts is correct although it seems to make tsc happy.

Bug: T260167
Change-Id: I2eced14c7df3b795b4de0e5149c2ca9fd598c7be
2020-12-08 13:28:42 -08:00
Jan Drewniak bd83398659 Integrate WVUI search into Vector
Creates a new skins.vector.search module that
replaces the searchSuggest module from MediaWiki core.

This module creates a new Vue app using the WVUI
search widget for the new search experience.

The legacy search input form is still retains on pageload,
and the new search kicks on search input focus.

In order to manage that transition, the legacy search
input is styled to resemble the new WVUI input, and the
new input is manually focused after the component mounts.

Vue is also added as a dev-dependency to help with
type-checking.

Other changes:
* the entry in skin.json is reordered alphabetically after
skins.vector.js

Bug: T264355
Change-Id: Ibb9561a77a14734297cb4d0ddcd415fc0750b45d
2020-12-08 13:27:12 -08:00
jenkins-bot 601b0fbd81 Merge "build: Updating mediawiki/mediawiki-codesniffer to 33.0.0" 2020-11-17 23:03:58 +00:00
Umherirrender 6d992c65b0 build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
Change-Id: I4ef344e62ce996b9d03d08b47c0f869ead417f7b
2020-11-17 23:33:50 +01:00
jdlrobson ffa19b2ae3 Use the SkinMustache template variable for the main page link
Bug: T248752
Depends-On:  I98fc4755e6a736efc2210f8b6ddf4a1cc4eea378
Change-Id: I077abba357e503c79901b64be2ccbb3f2efe1c18
2020-11-16 13:18:18 -08:00
jdlrobson 227534102a Separate opt out data from sidebar
In preparation for using the data provided by SkinMustache class
we need to separate the opt out data from the rest of the sidebar.
The opt out data is specific to Vector.

Change-Id: I4461da92c1787d272bbf99e6644bdb9e6c388a68
2020-11-05 22:08:00 +00:00
jdlrobson eda19bd6e4 Remove SearchInHeader requirement/feature
Styles will be cleaned up further in a follow up.

Bug: T258116
Change-Id: I878239a85ffbecb5e78d73aed5568c56dbd7d659
2020-10-28 20:05:28 +00:00
jdlrobson 14e8b4d5b7 Use SkinMustache value for user messages
This is now provided in the core SkinMustache interface and
is not needed here.

Change-Id: Iaee8fad2b1fd5e72beee544b0c2e8f62ff371073
2020-10-09 11:38:38 -07:00
Nicholas Ray 9031db0b20 Remove `#jump-to-nav` div
The "Jump to navigation" link was removed as part of
Ic553fab3bde25769b103d899b92b3b694c00c384 which makes this div seemingly
obsolete (Volker pointed this out). It has a faily ominous comment above
it so might need more investigation if it will break anything.

Change-Id: Ida97cb640885dc2ea4dfda5b475672eb1ad973f2
2020-10-09 10:37:33 -06:00
jdlrobson 89fee04f0b Drop unsupported skin CSS classes
Drop support for vectorMenu, vectorTabs and
vectorMenuCheckbox, body, menu selectors in preference
for standard selectors.

This change will impact a large amount of user scripts/styles but should
not impact any gadgets.

These classes were kept around for user scripts and styles however are not
needed internally. As we transition to a more maintainable skin menu
system, it is time to lose these selectors even though this will cause
disruption.

Vector now will use the mw-portlet class rather than the vector-menu
class in its own CSS styling, however it keeps the other classes to
allow differentiation of the different types of menu.

Changes to test: Previously the tests assumed all portlets were empty
when checking the classes. This is very rare, so its better to check
the classes of non-empty portlets, so several tests are updated
accordingly to drop the emptyPortlet class.

Bug: T262092
Change-Id: I1824335eb47d613c2a4804ec1f1106c0f4c16101
2020-10-01 19:50:24 +00:00
jdlrobson 4fad68ed0b Source footer data from SkinMustache
SkinMustache now provides this data in a slightly modified form.
Use it.

Change-Id: I060a8acfab6e7e2eea14e84fd4a5cad23677390b
2020-09-30 23:08:38 +00:00
jdlrobson c0ccbcb6f8 Prefer local data to parent data (attempt 2)
There was some confusion during the code review of
4dbe4076d6

In the case of array_merge, anything defined as the second parameter
with the same key as the first will override the data in the first. This
means the current situation is that parent data replaces any local data.

However, we want the local data to be preferred.
Specifically, the call to  $this->getFooterData() must override
the data set parent::getTemplateData. This is not happening with the current
ordering.

Without this change, Ib2af1f72c0508870b20321dffc8af2158d0dbd55
will result in the footer not rendering.

Bug: T262730
Change-Id: Iaf701c054314f210e40a82b5277e9914edccc493
2020-09-29 22:20:09 +00:00
jdlrobson 711a41812a Use newly available Skin::getPortletData method to get mw-portlet class
Kept as simple as possible for now. The new class is added but no classes
are removed. This will be done in a follow up.

Bug: T256897
Bug: T253938
Change-Id: Ib31a9d8f2ac14e63b63e82abd4a9aa1fcb956f45
2020-09-29 00:09:26 +00:00
jdlrobson 4dbe4076d6 Prefer local data to parent data
The + operator will drop any existing keys. The data from
Vector should have precedence as the data coming from core may be
in a different format.

Noticed while upstreaming data for footer.

Change-Id: Icc772733577e0b165acdbc8a9b6143bd5410c33a
2020-09-29 00:09:15 +00:00
Sam Smith 58c1c9ddf5 SearchBox: Fix data-search-loc attribute
Following on from I0edbd89, set the data-search-loc attribute to
"header-navigation" for legacy Vector.

Bug: T256100
Change-Id: I113c56ac9b18df46ebc13b9985aea03ba82419bd
2020-09-25 14:42:08 +01:00
Ammar Abdulhamid ef45378c01 Remove ULS extension hack and anon placeholder code
The anon placeholder is now provided by core. The styles will remain to
style it to suit Vector needs.

This ULS hack is no longer needed as the extension is already using array
plus operator which does set union, so it only appends the right-hand array
to the left-hand array. Some string concatenation that prevented it from
working correctly has now been resolved by Ice379cd in core.

Bug: T263382
Change-Id: I5691529ab8c59f4053cff38ea6f7dd01c326c074
2020-09-23 21:23:04 +01:00
jenkins-bot 05b6753937 Merge "Clarify documentation of SkinVector::__construct()" 2020-09-21 21:04:00 +00:00
Ammar Abdulhamid cf895f19e2 Clarify documentation of SkinVector::__construct()
With I5772eb7 merged in core, it's no longer accurate to say that the
$options param is optional.

It's important to note this now, before someone report it as a bug.

Since the method is a public API and technically does not require a
parameter, no one will expect that following the rules (providing no
argument, as in `$skin = new SkinVector`) will throw fatal exception.

Bug: T262233
Change-Id: I771e5cc8ff205943016a26854da18088817b9238
2020-09-21 16:59:04 +00:00
jdlrobson 5095b5c2f1 Vector supports language variant logos
Given I7184f2f5dd7fdb49fb928265bbf711ef9fd555c9 we can now
use the data generated by core which has the benefit of being
configurable per language variant.

Bug: T261153
Change-Id: I7a77f164da53c362da225ae3d13635f9ddca529f
2020-09-18 10:59:23 -07:00
Sam Smith 7cbc30ebac SearchBox: Add data-search-loc attribute
The mediawiki.searchSuggest protocol part of the SearchSatisfaction
instrumentation reads the value of an element with the "data-search-loc"
attribute and sets the event's inputLocation property accordingly.

Set the appropriate value for the attribute in
SkinVector::getTemplateData and render the attribute in
the SearchBox.mustache template.

Bug: T256100
Change-Id: I0edbd8906a042072b2055adc2889b083b2c6cac4
2020-09-17 18:24:24 +00:00
jenkins-bot 3bc308039c Merge "Make max-width the default for modern Vector" 2020-09-14 20:55:35 +00:00
jdlrobson 7449c7fdf6 A/B test of search in header for logged in users
A new config flag is added that buckets 50% of users into the old
header and the 50% into the new header.

Bug: T249363
Change-Id: I8b4fa475f9cd7e61ad2989e2a1485e7e64c8ab3f
2020-09-14 14:22:46 +01:00
jenkins-bot d72b0daa24 Merge "Use feature management for search in header" 2020-09-14 12:50:16 +00:00
jdlrobson c8642b2fbe Use feature management for search in header
This will allow us to add the A/B testing requirement for logged in
users.

In preparation for the new A/B test requirement, a custom requirement
is added as the feature management system does not
support OR operations and the desired effect is the case where:

* the SearchInHeader feature flag has been enabled
* OR the SearchInHeaderABTest feature flag has been enabled and the user is bucketed

Bug: T259250
Change-Id: If948603bd598e1b5597345f4268736417f4c3a24
2020-09-13 23:00:16 +00:00
jdlrobson 905ad68bc2 Make max-width the default for modern Vector
Drop max width feature flag.
Max-width will continue to not apply on special pages.

This saves us development effort by not needing to worry about
the case where the flag is not enabled. This flag is not false
in any production wikis.

Change-Id: I7ace4046e6b93ce63dd804da32e576a709485bfb
2020-09-10 20:14:38 +00:00
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
jdlrobson d61cae0086 Don't change function signature of buildSidebar
Rename buildSidebar to getTemplateDataSidebar to reflect what it is
doing in Vector rather than overloading it with template data generation.

Changing the return value has consequences on refactors
inside core a Skin::buildSidebar returns an array not an
associative array.

Change-Id: I0a4913c21af6ac3f5259cee8583aa121756251c1
2020-09-04 21:55:11 +00:00
jenkins-bot e77bd199f9 Merge "[Special:Preferences] [PHP] Add HTMLSkinVersionField form field" 2020-08-31 19:28:41 +00:00
Sam Smith 4449235516 [Special:Preferences] [PHP] Add HTMLSkinVersionField form field
I177dad88 introduced the skin version user preference field and
associated configuration values. Per T242381, the field is to presented
as a checkbox with the implied storage type of a boolean where a string
is needed. A PreferencesFormPreSave hook handler was added to adapt
values of either data type to the other.  While this was a neat solution
to a minor nit, the adapter's implementation is incompatible with the
GlobalPreferences extension as the PreferencesFormPreSave hook isn't run
whilst saving global preferences.

Rather than adding an equivalent hook to the GlobalPreferences
extension, create a custom field based on a checkbox with the adapter
included. This allows us to:

- Separate the business logic concerned with preserving the user's
  VectorSkinVersion preference if they've simply disabled Vector from
  the adapter

- Simplify the adapter's implementation

- Forego adding hooks to the GlobalPreferences codebase

Additional changes:

- Replace repeated string literals with equivalent constants in
  tests/phpunit/integration/VectorHooksTest.php

Bug: T258493
Change-Id: I628435a4ad676f55534191b8c10147be28be5d73
2020-08-31 12:04:12 -07:00
jdlrobson a39ebf7954 Don't render escaped HTML as HTML
Follow up to I610224d551ebea54ae32e9e79901befe80cfd5ce

Change-Id: I44caf1b484c86674bc1f86dfe42bc259dfa1f2ab
2020-08-31 09:45:47 -07:00
jdlrobson 5ac25943a2 Refactor: All messages should be listed from skin.json
This allows us easily to identify in templates what messages are
used and where, as well as allow us an easy way to tell when
messages are no longer being used.

Change-Id: I610224d551ebea54ae32e9e79901befe80cfd5ce
2020-08-28 17:12:10 +00:00
jdlrobson e7df44a66d Favor SkinTemplateNavigation::Universal
This hook is run on every page. The SkinTemplateNavigation hook
counter intutively is run only on pages which can exist. I think
it's clearer if we only use SkinTemplateNavigation::Universal hook
and keep the logic for when it runs inside our own code.

Bug: T255319
Change-Id: I0835074a6cadf6e9bdcc45299de37dd9328bf9b2
2020-08-20 16:01:27 +00:00
Sam Smith b46751d4ed hooks: Don't use SkinVersionLookup directly
The feature manager abstracts away how a feature is enabled from the
consumer of that feature. Accordingly, replace direct instantiation of
SkinVersionLookup with usage of the Vector.FeatureManager service.

Supporting changes:

- Add Vector\VectorServices, a simple wrapper around
  MediaWiki\MediaWikiServices that allows us to both document and
  type-hint services specific to Vector

- Add Vector\Hooks::isSkinVersionLegacy to minimise repetition

Additional changes:

- Make the MakeGlobalVariablesScript hook handler return early if the
  user isn't using the Vector skin like the other hook handlers

Bug: T256100
Change-Id: I93b5ef39802323c7ac658af8fa7cc312fff68aa7
2020-08-18 11:40:48 +01:00
Sam Smith 8d98ba35da hooks: Document CSS classes used elsewhere
Bug: T256100
Change-Id: I3fef99e5b94ca4dc221282f28c7608f84d8fb746
2020-08-17 15:27:32 -07:00
jenkins-bot 95896ff703 Merge "hooks: Don't send config variables unnecessarily" 2020-08-17 20:44:34 +00:00
jenkins-bot feae33a4e6 Merge "Remove VectorBeforeFooter hook" 2020-08-13 22:36:09 +00:00
Sam Smith 75ade04dfc hooks: Don't send config variables unnecessarily
The wgVectorDisableSidebarPersistence config variable is only required
when the user is logged in. Don't send it to the client when the user is
logged out.

Bug: T255727
Change-Id: I27eda8c18b438ef3251b2c07a0ed8b0cef6cae64
2020-08-13 15:37:45 +01:00
jdlrobson 53d9452795 Move the personal tools and search into header
To support roll out and avoid issues with cached HTML the new
styles for the new search feature are restricted to HTML where
the body tag has `skin-vector-search-header` class.

For legacy mode, we introduce a new class
`skin-vector-search-header-legacy` and temporarily use a CSS3 `:not()`
selector to ensure the styles ship during the phase where cached
HTML can be served. While this will create some display issues in
browsers that do not support CSS3 selectors, all grade A browsers in
our compatability matrix support this.

Bug: T249363
Change-Id: I7f8059d43eaab49de362405784b34a4fe502c7b0
2020-08-11 23:36:01 +00:00
mainframe98 ddc32a5833 Provide messages through skin options
Bug: T259664
Depends-On: Ie52aadd6b7de8c4db66de662f2f03e295c29034d
Change-Id: Ib03c0683aa00d334224e7b3507098dedcc848e44
2020-08-05 10:24:34 +02:00