Generalize LimitedWidthRequirement into a more reusable
UserPreferenceRequirement that can be used by both the limited width feature and
the persistent pinning feature (and possibly others in the future).
* Removes existing logic that checks whether the option is not null. Given that
skin.json sets the default [1], presumably this isn't needed.
* Adds unit test
[1] 65af26a258/skin.json (L163)
Bug: T322051
Change-Id: I7f228cf81a65b2eb22dbe94d2384b6c9f6da91f2
This patch involves cached HTML changes
- Replace '-content-container' id with '-unpinned-container'
- Replace '-content' id with '-pinnable-element'
- Rename pinnableHeader.js to pinnableElement.js
- Replace PinnableDropdownContents.mustache with PinnableElement/Open.mustache and Close
- Add PinnedContainer/Open & Close and UnpinnedContainer/Open & Close
- Rename .vector-dropdown-content to .vector-pinnable-element
- Add new PinnableElement.less stylesheet
Bug: T318013
Change-Id: I85aec387f87126a17e760fd9fd10e10572ff3152
The Dropdown component should be considered the dropdown folder going
forward. This should be distinguished as a different component that
composes the Dropdown component
Since the template itself is rather simple it seems preferable to have
duplicate templates that describe the actual component (PageTools,
VariantsDropdown and LanguageButton)
MenuDropdown is renamed Dropdown and styles that don't correspond to the
Dropdown component are moved to the relevant components.
MenuContents mustache template (future component) is added to DRY up
several of the new templates.
Bug: T320927
Change-Id: I220d0a477b3f05b278bd2cec7dd601c7b3b17c6f
[Visual Changes in this patch]
This patch introduces changes to whitespace inside the Mustache template
which corresponds to an HTML change, resulting
33 minor changes in pixel, the spacing of the ToC label shifts by
1 pixel
- Remove page tools feature flag from TOC
- Remove usage of .vector-toc-collapsed and .vector-toc-not-collapsed
- Remove now unused `moveToc()`
- Update jest tests to use PinnableHeader
Bug: T318013
Change-Id: I82f23e69b0249c844af9e45fec342217a0755893
Visual changes when the flag is on
Follow up to If3aed0ac401b0abc80c3ad52806eb85b33d43f06
More context at T322673#8383888
Bug: T322673
Change-Id: I64a47fa869247f758c6369c2e0ff8b12f87f9d9e
Changes:
* Code is moved from SkinVector to SkinVectorLegacy verbatim since it is now only
needed by SkinVectorLegacy
so we remove it:
** This step broke MainMenu rendering so this was captured in VectorComponentMainMenu
** The isLegacy code no longer makes sense and is removed in a follow up
* storybook no longer run on CI
Authors: Bernard Wang and Jon Robson
Bug: T321102
Bug: T319349
Change-Id: Ib424ca1c767161fdae8c0aeedfe662b7fa039ff6
To aid moving towards a MainMenu component we must first make subcomponents
for the language alert and opt-out link (which share code which
I've captured in VectorComponentMainMenuAction)
Code is lifted into SkinVector22 to allow us to easily make the template
change without any breaking visual changes
Bug: T319349
Bug: T322089
Change-Id: Ibb69d029a9fb6cee3482e15a60a7358361bd2405
* Introduce a generalized feature toggle system that uses user
preferences or localStorage for anons (right now the latter is out
of scope but will be explored in a follow up)
* Feature flagged to VisualEnhancementNext for now, given the dependency
on icon size
Bug: T319449
Change-Id: I7343a3f38b720411d5ef5f3414f25f475b0bb84a
Restricted to the feature flag (?vectorvisualenhancementnext=1)
for now to allow us to not worry about caching.
mw-ui-icon-flush-left and mw-ui-icon-flush-right have been in core
for some time and using them means we don't have to manage hardcoded
values for these.
We'll need to think of .mixin-vector-flush-left-left
and .mixin-vector-flush-right-margin-left separately - I wonder
if these could be revised to use these 2 standard classes.
Additional changes:
- Drop unused mixin-vector-flush-right-margin-left mixin
Bug: T321504
Bug: T317583
Change-Id: I51f8e31be6771a3fb32fb07dc22d0c2872b5706d
The legacy search wprov behavior, implemented in the WikimediaEvents
extension in searchSatisfaction.js, is to use acrw1_ as the prefix (i.e.
with an underscore before the index), and acrw1_-1 for user searches
that didn’t select a suggestion (not acrw1). Make the Vue search match
this in both cases.
Bug: T317682
Change-Id: I6c84533e1811233ff2727d501327471d73fc7b62
Making this a feature part of the feature management system is integral
to making this a toggle and will allow us to explore making this
persistent in future.
Bug: T319447
Bug: T319449
Change-Id: I80c7b892a6891094854b4154db90917b67986102
To avoid array query values to be used, see warning there:
"Array values are discarded for security reasons. Use {@see getArray} or
{@see getIntArray}."
This also fix that the falsy value "0" is checked against the regex
Bug: T321267
Change-Id: I29bc4a9a7fef5a6cadc0c6aa9fa1f4a03ccf9705
This ensures that the wprov parameter is included when users follow the
link as a link (click, middle-click, etc.), and also prepares us for a
future where pressing Enter after selecting a search result navigates to
that result’s URL instead of submitting the form. It also matches the
behavior of the legacy search form.
We put this in App.vue + instrumentation.js, not in urlGenerator.js,
because we also want wprov to be added when custom URL generators or
search clients are used. (The reason for instrumentation.js instead of
purely App.vue is just that it’s easier to test there.)
In the tests, we need to update @wikimedia/mw-node-qunit so that we have
a sufficiently functional mw.Uri() mock.
Bug: T317682
Change-Id: I765d3bbf89b2253add7b50305c362e4bbc9ecceb
* Removes server rendered vector-tab-noicon class from legacy Vector as it is
not currently used.
* Adds menuTabs.js responsible for adding the vector-tab-noicon class when menu
items are added to tabbed menus. This is only used in vector-22.
* Adds unit test
Bug: T320691
Change-Id: Iffad86125f8754305f592ddc19d894866bd6dedc
This allows the URL to the other wiki's rest.php to be configured
exactly, rather than assuming that it has the same wgScriptPath as the
current wiki. This is necessary to make this feature work on PatchDemo,
where wgScriptPath looks like '/123abc456/w'.
$wgVectorSearchHost is removed, since nothing uses it except PatchDemo
(where it's broken) and development setups.
Bug: T319494
Change-Id: Ife042f4f683d366a31a642723746d4aa80774c03
* Ensure addPortletLink hook is only run once
* Mark more menu as not supporting icons so icons are not added
Bug: T317491
Bug: T318495
Change-Id: I99450a5b0410e88cc7cdb2753b9b4256e3fe41db
Change I765d3bbf89 pushes the module over the configured maximum allowed
size (3 KiB, see bundlesize.config.json); shave off some bytes elsewhere
to bring it below the limit again. IMHO all of these changes should be
acceptable:
* arrow functions are already used elsewhere in this module;
* using the mw.config.get() fallback argument is normal (it slightly
changes behavior, but I don’t think explicitly setting the search
client or URL generator to a falsy value and expecting to get the
default behavior should be considered supported);
* not quoting [name="search"] matches [name=title] immediately above;
* using forEach() with a function reference is still readable (initApp()
is now called with extra arguments, but that doesn’t matter).
Change-Id: I45dda26cb59279d91804b0c2bbf12174fa78ee12
Change I45dda26cb5 removes some code, and in the process reduces the
branch coverage of the skins.vector.search module below the threshold of
25% that CI requires; add some tests for instrumentation.js to bring the
branch coverage up again.
Change-Id: I5d7ae019b3219b410c658583a6d72cf56d0cc1c5
- Changes the "skip to content" link to point to "#bodyContent"
instead of "#content".
- Adds a `aria-labelledby` attribute to #bodyContent.
- Changes the table of contents "back to top" link to
point to "#" instead of "#top-page".
- Removes "#top" link as it appeared unused.
- Updates Jest snapshots.
Bug: T312818
Change-Id: I86443066d45c818d6f137d70ebe36798eba66f13
The removal here is actually relatively straightforward.
References inside OverridableConfigRequirementTest are kept as
the A/B test capability remains after this removal and the tests
here do not relate to the code removed, just examples of how it
can be used.
Bug: T302027
Change-Id: I2dd92adaff1221d8213723e9ee60aa02787d4cc7
Can be tested by appending ?vectorvisualenhancementnext=1
to URL
Bug: T310838
Bug: T234990
Bug: T234550
Depends-On: I76d0d94c9006cc5f5680849ecdd1c382c16e34ba
Depends-On: Ib7c3021db014827b4b88cac855afc0b54a360f8c
Change-Id: Ie2ffa5c3ecf270c1bb1f315937023ae7ace5ed30
* Updated usages to use SkinTemplateNavigation::Universal
in preparation for the hard deprecation and removal of the hook.
Bug: T310017
Change-Id: I133c7479da294c0b8c908ad8d34690297f08200b
This is a common need for features, and having these use a standardized
class name will make using them a lot easier.
Change-Id: I0e16c26878e7d4399d2bf57f236523d214951a27
This class is no longer needed in Codex and will be removed.
This patch adds a similar dynamic class to the Vector search
app, to be used for showing/hiding the search button on
focus/blur or hover/leave.
Bug: T316893
Change-Id: I738c0f24dcd06ddeb9179cfedc85ed73a6504f1e
Adds tests for the addPortletLinkHandler, which should
add an icon element to items added via 'mw.util.addPortletLink'
and conditionally move elements from the toolbar into
the more menu at narrow widths.
- Adds tests for dropdownMenu.js
- Adds associated Jest snapshots
- Stubs the mediawiki.page.ready module
- Updates mockMediawiki.js to 4.6.0
- Adds global mock for mw.util.showPortlet()
- Cleans up tests using local versions of these mocks
Bug: T314798
Change-Id: I81394d840321916756a41a23c40d96c4b6341931
Throw a runtime exception if the TOC experiment is setup correctly.
Otherwise this leads to confusion.
There must be 3 buckets, with 0 unsampled and equally weighted
control and experiment.
Bug: T313435
Change-Id: I09da238ff17b77a053b4dc132624ea19a86253b9
- Make 'updateMenuItem' generic, rename to 'updateItemData'
- Make 'appendListItemClass' generic, rename to 'appendClassToItem'
- Remove 'appendClassToListItem' and replace with 'appendClassToItem'
- Create 'updateMenuItemData', 'updateLinkData', and 'updateDropdownMenuData' wrapper functions to be used in Hooks and SkinVector
- Add and update tests
Bug: T307901
Change-Id: I4b12a0c1aab1224d2658bad30ee629f7266c5b7e
Visual changes:
- TOC icon in sticky header
- Small update to the narrow screens collapsed TOC spacing when open
Bug: T311103
Depends-on: Ic94fda79bd14856ccda14985d5860aa54d3118d0
Change-Id: I977092f951ba2843816609e706bce4b99583f623
Removes the .mw-ui-button styles from the userpage link
and create account link in the user menu.
Overrides the userpage redlink style so that the link
remains blue even if the userpage doesn't exist.
Visual changes: userpage link and create account link
in header are no longer .mw-ui-buttton styles, but
look like standard blue links. The user links menu shifts
slightly because of this as well.
Bug: T312157
Change-Id: Id98e566952e5875527f38d1edbc8f6e058af4518
- Include temporary feature requirement for TOC A/B test.
- Assumes 100% of logged-in users with even/odd user ids
being assigned to treatment/control buckets respectively.
- Sampling rates passed in by config are not considered
during bucketing.
- Update hook for adding needed TOC A/B test body classes.
- Add test for temp feature.
Note: the temporary feature requirement and associated hooks
should be removed once the 2nd TOC A/B test concludes.
Bug: T313435
Change-Id: If9c75235614af289cd50182baab29bec3155eb81
For idwiki/viwiki, we wish to run the sticky header edit button AB
test so that treatment1 group sees the sticky header without edit
buttons, treatment2 groups sees the sticky header with edit buttons,
and the control/unsampled groups see no sticky header at all.
This patch overrides the configuration to make the sticky header
w/o edit buttons for treatment1, sticky header w/ edit buttons for
treatment2, and hides sticky header for everyone else. This depends
on a configuration with the treatment groups having "treatment1"
and "treatment2" as substrings in their bucket names.
The full configuration for idwiki/viwiki would be something like
the following:
```
$wgVectorStickyHeader = [
"logged_in" => true,
"logged_out" => false,
];
$wgVectorStickyHeaderEdit = [
"logged_in" => true,
"logged_out" => false,
];
$wgVectorWebABTestEnrollment = [
"name" => "vector.sticky_header_edit",
"enabled" => true,
"buckets" => [
"unsampled" => [
"samplingRate" => 0
],
"noStickyHeaderControl" => [
"samplingRate" => 0.34
],
"stickyHeaderNoEditButtonTreatment1" => [
"samplingRate" => 0.33
],
"stickyHeaderEditButtonTreatment2" => [
"samplingRate" => 0.33
]
],
];
```
Bug: T312573
Change-Id: I15c360fdf5393f5594602acc33b5b916e904016d
- Rename 'vector-user-menu-more' class to 'vector-user-menu-overflow'
- Update storybook and tests
Visual changes
- Small intentional change on the create account button
Bug: T306662
Change-Id: I371bb11903d8cdd8f0da89266fcf549050c0da8c
There are two issues with context in this test case:
1. The $vectorTemplate object was not given the $context object.
Calling setContext() is the same as MediaWiki would normally do
after calling SkinFactory, e.g. as in RequestContext::getSkin.
2. The "main" glboal state was leaking into the test by mutating
the result of getMain() instead of creating your own for use
in the test.
Change-Id: I09eb8c3a38c0d4e2c85461b61e6f14ab00995016
- Update related selectors, styles.
- Remove unneeded styles.
- Remove link hijack js.
- Simplify hook to only add experiment name to body.
Bug: T310527
Change-Id: I25527261d529a16e28f1b90f2f5af234d26fd40f
[Visual changes]
This should result in 9 visual regression failures relating to
increased height of search results and loading bar
[More details about change]
- Migrate search app from Vue 2 to Vue 3; update tests
accordingly
- Remove dependence on WVUI and use Codex instead, via the special
`@wikimedia/codex-search` package
- Update search app to use CdxTypeaheadSearch, which no longer
takes in props related to the search client or fetch start/end
instrumentation. Instead, directly use the restSearchClient
and call fetch start/end events in the search app.
- Handle hideDirection in the search app/API response formatting
code, not within the TypeaheadSearch component
- Handle showing/hiding the search button in the app
- Move the WVUI URL generator into Vector
- Update server-rendered search box styles to match design updates
included with CdxTypeaheadSearch
- Replace references to WVUI with references to Codex
- Update values of various LESS variables to match Codex, and update
searchBox styling to prevent jankiness when the searchBox is replaced
with the Codex TypeaheadSearch component
The VectorWvuiSearchOptions config variable has been maintained and
will be updated to a code-agnostic name in a future patch.
Bug: T300573
Bug: T302137
Bug: T303558
Bug: T309722
Bug: T310525
Co-Authored-By: Anne Tomasevich <atomasevich@wikimedia.org>
Change-Id: I59fa3a006d988b14ebd8020cbd58e8d7bedbfe01
Use overrideConfigValues instead of installMockMwServices and setMwGlobals.
This ensures that configuration overrides are handled consistently.
This also fixes a data provider that relied on a service, which causes
the test to fail when not run via the pgpunit wrapper.
Depends-On: I898927717ce961d98617a7fcd9c7fa8e19bec412
Change-Id: I6354fa39e1e9adf4be6eb6b26db82b8f106c593e
SkinVector and Hooks both had code to add classes and handle Vector specific template data. This patch simplifies the way we handle menu data to always use Hooks:updateMenuItem. This has an additional side effect of removing instances of mw-ui-icon-before.
Bug: T306628
Change-Id: I73514a0eada4d92705b70e7c2ebd91092fc12544
Follow up to c5cfd4d
1) Partial paths are incorrect
These are not a problem with our current Mustache template
parser but could break with any changes in our PHP implementation
2) Add dedicated class to legacy menus
On the longer term this will allow us to further separate the
old and new CSS.
Change-Id: I056b033855c28f919a4af99784620503f10b9dcb
When the vector-sticky-header-enabled class is removed from the body
it means the feature is not enabled, it doesn't mean the sticky header
should be invisible.
Call the hide method instead, and move it out of the function given
its a side effect
Bug: T308343
Change-Id: I4ecd6524146f203af926847812e20275c9573cab
Add action=edit to the exclusions in $wgVectorMaxWidthOptions
and update the parsing of the query string values for that config
variable to accept a regex.
Bug: T307725
Change-Id: Iba526033d45e18cb340a2648378d3d90ef3ae3c6
- `MediaWiki\Skins\Vector\Tests` is now the prefix for all tests in the skin
- we followed PSR conventions of following folder structure after the prefix
- Optimize imports/use order
- update namespace in skin.json
Bug: T303102
Change-Id: Ib76374d81d973c83adfd6c8e7863ff6d797e655d
If LOG_DIR environment variable is set, create report there.
If it is not set, create the report in 'a11y/'.
Bug: T301184
Change-Id: I74fa6e8ee59d43e5a6e57083999107ac27446a62
The report was created in log/a11y folder until now. Looks like Jenkins
expects it to be in log folder.
Bug: T301184
Change-Id: I9926e7446e4fc86526dab963066511bf8da2271e
When browser preference for reduced motion is enabled:
* Disables bolding of table of contents
* Disables sticky header transition
Bug: T254399
Change-Id: I8ef9e59b258fed977ce370da352b1924832d842b
Ideally the TOC has an h2 after the article title h1, but because of the TOC sticky positioning and its placement in the grid, we cant use an h2 without messing up the heading order.
Bug: T301051
Change-Id: I462ddfb618ddd422c9f71293280d1790c4846f50
Replaced “vector-menu-heading” with ‘’(empty string) in “$portletData['heading-class'] = '';”
in includes/SkinVector.php and updated accordingly the includes/templates/Menu.mustache file.
Updated “vector-menu-heading” with ‘’(empty string) in stories/LanguageButton.stories.data.js,
stories/UserLinks.stories.data.js, and tests/phpunit/integration/SkinVectorTest.php respectively
SkinVector and Storybook are cleaned up.
Bug: T290281
Change-Id: I4ca16953799b3dc52e45674bb398c78f14cfc842
This makes built assets available in jenkins,
Also addresses miscellaneous feedback relating to configuration
variable name and track topic name.
Change-Id: Ic70d517eba96aab6512a96ea19d6be56b3664871
It didn't vary by the skin version as documented in the Constants class,
and merely another instance of GlobalVarConfig.
Change-Id: I0acd0366a241e04bb79f6aae5dc52284dfa578df
* 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
The LatestSkinVersionRequirement is problematic for various reasons:
1) It uses the "useskin" query string
parameter which may or may not refer to the correct
skin (in the case of a non-existent skin it will always come to the conclusion that
it is not modern Vector and thus must be legacy).
2) It uses the User object which may or may not be safeToLoad
depending on when called.
The feature seems redundant at this point, as we are separating code
into separate classes Vector and Vector22 and all the features only apply
to modern Vector. I suggest we remove it and use the features explicitly in the skin
intended.
Bug: T305232
Bug: T305262
Bug: T302627
Change-Id: I92fa33547bd601e05ddc8c1468e681892e47c16b
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
* 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
A user with an ID is a registered user and this test requires
an anonymous user.
Follow up to a1afa7ccb3
Not sure why this was working before, but I'm guessing
setId doesn't modify the User associated with the skin
Change-Id: I32bd74bd5aec1b14fb8b725fca2f8cef5f9d2ba1
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
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
- Add test for SkinVector::shouldLanguageAlertBeInSidebar() method.
- Change some methods to protected status -- acknowledging this is not
an optimal change. Until we can pull out some of the language checks
into its own class with injected dependencies (title, feature manager,
languages), this is an interim solution to try to catch regressions
since the conditional states for showing the alert are complex and
ultimately temporary. Extracting the language checks into their own
class can be done in a follow up ticket to help optimize testing
language checks in isolation.
Bug: T302018
Change-Id: I99b7df3029e0af86e4d67b3f446d4ce99260d33e
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
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
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
The behavior of data loading can differ between submitting and display,
so use FauxRequest to customize the method.
Also fix the order of parameters passing to assertSame(), the first one
should be the expected one.
Change-Id: Icfa062eada75c50cd2c8bc5db2930602d80e9ae7