Commit Graph

258 Commits

Author SHA1 Message Date
Jon Robson f38a2afbf6 Restore persistent sidebar
Bug: T305989
Change-Id: I1304c777ad9581cd8b9153ad1e4483e31660857e
2022-04-18 19:44:11 +00:00
bwang 21f124dad5 Fix missing create account link icon and ensure icon attributes aren't showing up in rendered HTML
Bug: T306116
Depends-on: I509dd153ea2c1e04cb89415f185b7abbe0403773
Change-Id: Iaea83098fda7d77fda6629722dcef3e17e21fe06
2022-04-14 11:03:56 -05:00
Clare Ming 28a3c06cdf Replace TOC arrow icon
Bug: T304166
Change-Id: I182c9e5399d95ecea58dcdabb563a98b4e34e47e
2022-04-11 14:56:42 -06:00
Func b61a92f052 Drop the Vector.Config service
It didn't vary by the skin version as documented in the Constants class,
and merely another instance of GlobalVarConfig.

Change-Id: I0acd0366a241e04bb79f6aae5dc52284dfa578df
2022-04-07 04:30:20 +00:00
Nicholas Ray 6fbf08a198 Build A/B test bucketing infrastructure for the table of contents.
* Bucket and sample on server by using the
  `WikimediaEvents.WebABTestArticleIdFactory` service from
  WikimediaEvents (soft dependency)
* Add linkHijack.js so that users bucketed in one group have the
  possibility of remaining in that group if they click a link to another
  page.

Bug: T302046
Depends-On: Ie6627de98effb3d37a3bedda5023d08af319837f
Change-Id: Iff231a976c473217b0fa4da1aa9a8d1c2a1a19f2
2022-04-04 17:06:29 -06:00
Tim Starling 254ffbb55a Don't set a user preference on new accounts by default
Make it possible for Vector to be a non-default skin. Only set a user
preference on newly created accounts if that has been explicitly
requested in config.

This should have no effect on WMF production.

Change-Id: I52f62cf7eb78d2be4c59821a3cf29da9619602d9
2022-03-31 14:52:20 +11:00
jenkins-bot ac5c82cfb8 Merge "Drop SkinVector global class alias" 2022-03-29 17:54:46 +00:00
Reedy 0d5e2d184e Drop SkinVector global class alias
Change-Id: I0e35a3c88aced671ef23318bf3970f7f3f261f6a
2022-03-29 17:32:39 +01:00
Jon Robson 413f92561d Restore the classes skin-vector and skin-vector-search-vue to body
The option is set incorrectly.

Change-Id: Iafccb427b87f9a877374745b48b4ec1519de7e11
2022-03-29 08:50:10 -07:00
jenkins-bot cd04b72058 Merge "Table of contents links to beginning of article" 2022-03-24 23:51:52 +00:00
Jon Robson dfdf72140c Table of contents links to beginning of article
Bug: T301254
Change-Id: Icb0b0646f81c1070c8f47dd3297225a074f74773
2022-03-24 20:46:35 +00:00
jenkins-bot 24b5d5840e Merge "End migration mode" 2022-03-23 17:03:38 +00:00
Jon Robson b109e10cf3 End migration mode
Can be merged when database rows have been updated to
no longer use skin version.

* Drop migration code
* Drop skin version preference
* Drop default skin version and existing accounts skin version
* Move skin definitions into skin.json
* Repurpose SkinVector as an abstract class
* Update READMEs

Bug: T301930
Bug: T294995
Bug: T302627
Change-Id: I7454d8f1cfdef81e7f3df476d8ce86736b46fff2
2022-03-23 16:46:42 +00:00
Nicholas Ray d01dead5a7 Revise AB.js to handle other features + server sampling/bucketing
* Eliminates AB.js dependency on sticky header
* Code coverage has been raised to 100%
* Instead of importing ABTestConfig, these props are now passed into the
  function along with a token.
* WikimediaEvents hook is now fired when experiment is initialized. The
  experiment should not be initialized if it is not enabled.
* Removes several methods (e.g. initAB, getEnabledExperiment) due to the
  preceeding changes.
* Adds `isInSample` and `isInTreatmentBucket` methods so that the client
  has less work.

Treatment buckets now follow a naming convention so that the client can
do less work querying if the subject is part of the treatment:

* Treatment buckets should have the case-insensitive `treatment`
  substring somewhere in their name (e.g. 'treatment',
  'stickyHeaderTreatment', 'sticky-header-treatment' )

Bug: T302046
Change-Id: I4febec42b4c471b2f2ef02be2e334bd6d2c31eec
2022-03-22 11:58:48 -06:00
jenkins-bot 08efa139be Merge "Remove custom handling of aria-expanded in Vector checkbox hack buttons" 2022-03-21 18:03:14 +00:00
Mortal303 ae50914d4e Remove custom handling of aria-expanded in Vector checkbox hack buttons
Removed class "vector-menu-checkbox-expanded" and "vector-menu-checkbox-collapsed" in
includes/templates/Menu.mustache and deleted the necessary lines in
resources/common/components/MenuDropdown.less, tests/jest/stickyHeader.test.js,
includes/templates/skin.mustache, skin.json, i18n/en.json and i18n/qqq.json.

Bug: T299173
Change-Id: Ibf8a08e6e5d1a6c607abf170c030a0285e84ad74
2022-03-21 23:14:51 +05:30
Jon Robson 6855979a92 [i18n] Table of contents heading
Should be translateable

Change-Id: I3c4515f16b5300a44f89ebdcd426a9d8ac6ad138
2022-03-16 17:18:51 +00:00
Reedy 1dcfe80ac3 Namespace SkinVector* PHP classes
Namespaceless class aliases are left behind for migration purposes.

They can be removed at a later date when dependant extensions
and skins are fully updated.

Bug: T301204
Change-Id: I2b37c1889ff862ec8bb41325fc9f654c673cd115
2022-03-04 13:30:21 +00:00
Nicholas Ray 6e9506dcad Dynamically expand/collapse sub-sections in ToC based on # of headings
Server render the table of contents in a collapsed state when the total
number of headings is equal or greater than the value of
`$wgVectorTableOfContentsCollapseAtCount`. Otherwise, the table of
contents will be server rendered in its "expanded" state.

In addition:

* Revise table of contents tests to call one `assertion` per element so
  that it is easier to see the exact element that may fail an assertion.
* Revise table of contents tests to call a mount function that can merge
  props to allow for a more flexible set of tests.
* Revise table of contents tests by wrapping a `describe` around tests
  that expect the same prop state.
* Adds typedef for table of sections props

Bug: T300973
Depends-On: Ifaee451e1903f2accd0ada2f2ed6dfa3f83037b6
Change-Id: I382200bc603b6abf757a91f14a8a55a6581969bd
2022-02-21 14:58:51 -07:00
jenkins-bot 914e3d55e6 Merge "Add fetch tests from WVUI" 2022-02-16 22:07:18 +00:00
bwang a560fb814a Add fetch tests from WVUI
Bug: T288686
Change-Id: Ifeb2e355482d3d5920c2535c89193cc4f36a13c9
2022-02-15 14:00:40 -06:00
Jan Drewniak 7d32ec80d3 Collapse ToC by default & expand sections when clicking section headings
Collapses sub-sections in the new table of contents by default
(except for non-js and reduced-motion users) and expands the
sections when the top-level section link has been clicked.

Refactors the `activateSection` TableOfContents methods into separate
`activateSection` and `deactivateSection` functions.
Adds `expandSection` and `collapseSection` methods.

Adds triangle icon as a visual expand/collapsed indicator
next to all ToC section headings and are hidden via CSS based on
whether or not the section contains subsections.

Adds test for tableOfContents.

Bug: T299361
Change-Id: I36b3ae7f9f633877683bc17a9444c970d7fa7293
2022-02-15 00:09:50 -05:00
bwang 3e92800bd6 Move REST search client out of WVUI into Vector
Bug: T288686
Depends-on: I4afc8c38dc9c51d55b46b766a1417b1266963482
Change-Id: Iac6023bb6edca5c8dddc3bfd362db727b2534946
2022-02-10 10:17:10 -06:00
jenkins-bot 306dc89bf8 Merge "Limit WVUI search to ES6 browsers" 2022-02-09 23:01:03 +00:00
Jon Robson 0c2981d772 Limit WVUI search to ES6 browsers
Rather than test for fetch, limit the code to ES6 browsers.

Depends-On: I96a03796628a74ace93579d45a582711400c09c1
Change-Id: I4ca10182491118e61e155f99c713d4cb1b4fc7f0
2022-02-09 22:10:11 +00:00
Ammarpad 5c4d917497 Update Vector SpecialVersion description
Bug: T300994
Change-Id: I3f624013ec4ce408c50d66eca7a91b55b1288ae9
2022-02-09 20:23:09 +01:00
Nicholas Ray 80a111d0e4 Fix TOC section activation on link click bug
We want the link that the user has clicked inside the TOC to be "active"
(e.g. bolded) regardless of whether the browser's scroll position
corresponds to that section. Therefore, we need to temporarily ignore
section observer until the browser has finished scrolling to the section
(if needed).

However, because the scroll event happens asyncronously after the user
clicks on a link and may not even happen at all (e.g. the user has
scrolled all the way to the bottom and clicks a section that is already
in the viewport), determining when we should resume section observer is
a bit tricky.

Because a scroll event may not even be triggered after clicking the
link, we instead allow the browser to perform a maximum number of
repaints before resuming sectionObserver. Per T297614#7687656, Firefox
wasn't consistently activating the table of contents section that the
user clicked even after waiting 2 frames. After further investigation,
it sometimes waits up to 3 frames before painting the new scroll
position so we have that as the limit.

Bug: T297614
Change-Id: If3632529f58c15348a7200258f4f5999ea0dadc4
2022-02-08 14:45:16 -07:00
jenkins-bot d94c685f02 Merge "Use bodyClasses option to register static classes on skin" 2022-02-08 16:25:02 +00:00
Jon Robson 29498112ed Migration mode is now the default
- Reflect production.
- Update SkinVector migration notes.

Depends-On: Ia527e60901de59f9e094ca0f1ba62a67a2f808a2
Change-Id: I8efa56fa0644b2ceb33fdab16da5df1d44ee621f
2022-02-07 22:20:16 +00:00
Jon Robson 6f7a6bb24b Use bodyClasses option to register static classes on skin
Bug: T298734
Change-Id: Ia2ae8e1c655aff8783c2602da992632cd5877bf8
2022-02-04 18:44:43 +00:00
Jon Robson ddcf51a9ec Drop skin override
This is often used by gadgets/scripts to request
information from the API. Given `vector` means old Vector
now that leads to styling issues.

The unfortunate side effect of this is that any code
checking mw.config('skin') === 'vector' will no longer work
and we'll likely need to patch various gadgets accordingly.

Bug: T300814
Change-Id: Ic920e91960cf81790096395256b75f8ed0dc4173
2022-02-03 19:00:24 +00:00
jdlrobson d8382ec96b Drop search related feature flags
Given Wikidata is the only project using modern Vector,
and the only project where the search API is not applicable,
this will result in a loss of autocomplete on Wikidata.org
which will fall back to the non-JS mode.

Bug: T290688
Change-Id: Iece5a4efd43e09cd90c842c9c134ca115b35f2b2
2022-01-31 21:00:22 +00:00
Jon Robson ac084e930a [config] Vector should default to language button
This reflects production and avoids confusion during development
e.g. T299581#7660160

We already have overrides in place for all wikis where this should not
apply.

Change-Id: I45ecda031f83fc63c9c878c9caef42d327b2463f
2022-01-28 15:38:27 -07:00
Clare Ming a1ba537f6a Enable sticky header by default
Bug: T297924
Change-Id: If95a917ab3fbbe49271c62e0ce1da8b74d0bd7b8
2022-01-28 10:46:48 -07:00
jenkins-bot 24e7430734 Merge "Add sectionObserver and tableOfContents component JS to respond to intersection changes" 2022-01-27 17:13:08 +00:00
Jon Robson 6534f01162 Opt out of external link icons
This was related to two unintentional regressions as we switched
off the legacy feature in July 58c87018 in legacy Vector,
and 722b5fbf in modern Vector.

Bug: T298433
Change-Id: Id258e328d1691f7bd31d2b3c57d64d5434706561
2022-01-27 15:26:39 +00:00
Nicholas Ray 3c433a5315 Add sectionObserver and tableOfContents component JS to respond to intersection changes
This commits sets up the Table of Contents to bold the active section
when the section is scrolled.

Unfortunately, because our content does not have actual sections but
instead has a flat list of headings and paragraphs, we can't use
IntersectionObserver in the conventional way as it is optimized to find
intersections of elements that are *within* the viewport and the
callback will not reliably fire during certain scenarios (e.g. with fast
scrolling or when the headings are not currently within the viewport).
Furthermore, iterating through a list of elements and calling
`getBoundingClientRect()` can be expensive and can also cause
significant forced synchronous layouts that block the main thread.

The best compromise in terms of performance and function that I've found
is to use a combination of a throttled scroll event listener and
IntersectionObserver's ability to asyncronously find the
boundingClientRect of all elements off the main thread when `.observe`
is called which is the approach this patch takes. Although this is an
unorthodox way to use IntersectionObserver, performance profiles
recorded while holding the "down" arrow and scrolling for 10 seconds
with a 6x CPU throttle are comparable between master and this patch:

master: https://phabricator.wikimedia.org/F34930737
this patch:  https://phabricator.wikimedia.org/F34930738

Bug: T297614
Change-Id: I4077d86a1786cc1f4a7d85b20b7cf402960940e7
2022-01-26 14:11:43 -07:00
Jon Robson 1149d3d611 Drop watchlist in user menu feature flag
Working correctly. No longer needed.

Additional change:
* add tooltip to menu

Depends-On: I418ce75bda8015520d1f1742ddcdfefbc8b9a162
Bug: T289619
Change-Id: I42f21ca8836e5042d07102e1516ca386478dfabc
2022-01-19 16:10:32 +00:00
Jon Robson dc6d020410 Add watchlist icon to Vector
Depends-On: I5b1af082503fe22ec6049784fc43b324534c5b95
Bug: T289619
Change-Id: Idda8c49fe2833f3a64d7cc6d6db91bb6c3cde07e
2022-01-14 01:25:11 +00:00
jdlrobson f7e6e044dd Use configuration to skip vector-2022 skin
This allows us to manage changes going forward in configuration

Depends-On: If50fedaccf959f7ae74c86caf81555ef4f46abd1
Bug: T298923
Change-Id: I09e2b417b496678db0841354e90fdaf6237eb226
2022-01-12 22:32:13 +00:00
Jon Robson df84ed42d2 SkinLessImportPaths should work on Vector 2022 edition
Change-Id: Ib3cf9c8820dc9baf1a2f85752b17e3dba3195f84
2022-01-12 11:38:27 -08:00
Jon Robson cb94cf0ab9 Hide language button in sticky header if compact links disabled
Bug: T297579
Change-Id: I8d5294a986d76574284419efc7d384fc954a86c8
2022-01-10 14:42:26 -08:00
jenkins-bot 0488310612 Merge "Restore gadget support to new internal skins" 2022-01-07 20:41:44 +00:00
jenkins-bot 84ed8343c2 Merge "Vector is split into 2 skins" 2022-01-07 20:16:57 +00:00
jdlrobson 99cf6eb5be Restore gadget support to new internal skins
For vector-2022 skin:
* MediaWiki:Vector.css and MediaWiki:Vector.js are added via the
existing ResourceLoader hook.
* User:<name>/vector.js and User:<name>/vector.css are added via new
VectorResourceLoader modules

Bug: T297758
Change-Id: I37e9a9d353695502213c7a651530995252d9505f
2022-01-07 00:18:17 +00:00
jdlrobson 7d2d50873f Vector is split into 2 skins
A new vector-2022 skin is added. This will be the eventual home
of the new Vector skin when we are ready to migrate.

Please see SkinVector class for the migration plan to simulate this
as part of testing.

Bug: T291098
Change-Id: Ibaddf94a5bfb5e21bbbaf1e0aa1b343a3f566d2d
2022-01-06 15:52:10 -08:00
jdlrobson d8010c321a Fix dependencies for debug mode
Saw Query.Deferred exception: mw.user.getId is not a function
when using debug mode due to missing dependency

Change-Id: I9ff89e5632da6941bce77b079dee36f47a5fbcc8
2021-12-21 23:00:12 +00:00
bwang bd799ecc2e Add watchstar to sticky header (alternative)
Bug: T294759
Depends-on: I88af8585e8fc75f77ebef867d267199aeb2c6592
Change-Id: I15c409830ef8970ff7319b4dd447904443949b8d
2021-12-21 09:40:48 -08:00
jenkins-bot c6691a191d Merge "Disable table of contents in article body" 2021-12-17 00:17:16 +00:00
jdlrobson ef59d7b973 Disable table of contents in article body
This will currently remove table of contents in article body
for legacy and modern skin.

To prevent us deploying this in current form, a check is
added in generateHTML

This requires an adjustment of OverridableConfigRequirement to
support requirements which do not vary on whether the user is
logged in or not.

Bug: T297610
Change-Id: I847a284229e498b3aa04c16ea3f84c360e735052
2021-12-16 16:11:05 -07:00