Commit graph

149 commits

Author SHA1 Message Date
Jon Robson 0630a96d3a Do not hardcode uls key
The menu may have other items. This is needed by
WikiLambda extension.

Bug: T341500
Change-Id: I6884b04f3137dc1111bdc7642068aa436907caf6
2023-07-21 17:27:51 +00:00
Noa wmde 2c96f9b3d7 Allow overriding the search pattern highlighting for Wikibase
Use a php hook to override the highlightQuery attribute.
This allows us to turn off search higlighting for all
wikibase repo instances.

Bug: T327510
Change-Id: I0ef27da9cf4ac66151d1a391e9f606100097d7f0
2023-07-11 23:56:29 +00:00
Jon Robson 68239ae344 Use Codex for button styles, start transitioning icons to use Codex icon mixins
Changes:
- mw-ui-button to cdx-button
- mw-ui-quiet to cdx-button--weight-quiet
- mw-ui-icon-element to cdx-button--icon-only
- mw-ui-icon to vector-icon
- mw-ui-icon-flush-right/left to vector-button-flush-right/left
- Removes $isSmallIcon param in Hooks.php

85 Visual Changes
- ~36 changes from minor pixel changes from the new button classes in the main menu, language button
- 22 from standardizing the padding of the TOC in page title
- ~10 changes from addition of .cdx-button to the TOC toggle buttons

PERFORMANCE:
This will result in an overall increase of 2.7kb of render blocking
CSS, 1kb will be reclaimed when
I6c1ed1523df8cc9e2f2ca09506f12a595b8b013d is merged.

Co-author: Bernard Wang <bwang@wikimedia.org>
Bug: T336526
Change-Id: Ibd558238a41a0d3edb981e441638f9564f43d226
2023-06-12 16:26:28 -07:00
bwang d8bcb73647 Update user menu and watchstar buttons to be consistent with spec
Depends-on: Ibd762c810e1d89047e39ce3af792b43689bf11e3
Bug: T335909
Change-Id: I5b42780416b466cc3fc33d29220aef2979ac3239
2023-05-03 15:47:00 -07:00
Jon Robson 28ada2dc78 Refactor: Separate A/B test configuration from site configuration
Making it easier to add configuration variables to JavaScript
in future. This will be used for the pointer indicator.

Change-Id: I65396a3867e7e92d7385ebaa573fb48105ecb9fd
2023-04-11 22:40:45 +00:00
ksarabia d983dadab4 Remove Vector2022PreviewPages configuration
Remove Vector2022PreviewPages configuration in Hooks and Skin.json.

Bug: T332797
Change-Id: I2c28a4e253b4dc17578793e1e4ce73e80392d08c
2023-04-04 17:07:04 -05:00
Jan Drewniak 15be8a0340 Remove custom sidebar config
Removes configuration for
1. Custom sidebar pinning
2. Default sidebar visibility for logged in & anons

The first config is no longer necessary because
the main menu now uses the pinnable header for
showing/hiding and persisting it's state.

The second config is no longer necessary since
the Page Tools menu moves many sidebar items into
a different location.

Bug: T332090
Change-Id: Iaf25237757dc1e43e096b8c5991e9dd31ad25c2d
2023-03-31 13:09:04 -04:00
Umherirrender 1c3a85d9b0 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 39.0.0 → 41.0.0
* mediawiki/mediawiki-phan-config: 0.11.1 → 0.12.0

Change-Id: I58715f1303b6c709f73b618abbfcef2b817531df
2023-03-18 22:21:56 +01:00
jenkins-bot ba00ff199f Merge "Fixes missing account login in OfficeWiki" 2023-03-09 21:58:38 +00:00
ksarabia 108aeb2d88 Fixes missing account login in OfficeWiki
Addresses missing login button and dropwdown by adjusting Hooks.php

Bug: T329463
Change-Id: I0fa630f5fef7fdd651fda1331762ffefbb1c5b75
2023-03-09 15:39:50 -06:00
Jon Robson 26d5d44535 Extend new config flag to site styles
Bug: T301212
Change-Id: I50d898a541707063594dfbc16a6bbfaabab42162
2023-03-09 18:52:12 +00:00
ksarabia 74addde337 [WIP] Removes the TOC class in body and adds in html
Adds new constants for TOC and registers feature.

Bug: T325032
Change-Id: I5e0f5f3a6d186b245bdbc98c2bb9e4cc17a03fdb
2023-02-28 17:21:16 -06:00
Jon Robson f2fb827630 Revert "Updates for core temp user autocreation feature"
This reverts commit 8d0659b1e6.
The logic for temporary users is now centralized inside
MediaWiki core, so Vector has no need to check whether a user
is temporary and instead work with the data it's given.

Depends-On: I36815aaef81ec7368e240a780e90bd574785df74
Bug: T328725
Change-Id: Ie30dd6a77ef391f74a435e0b9df74793ffdf73bb
2023-02-21 11:30:27 -06:00
bwang 9e4bdd00bf Remove custom handling of user links menu items and handle case when anon editor links are disabled
Rather than try to build individually build login, logout, and create account menu items, we handle them the same as all other user links menu items in Hooks.php. While Hooks isnt ideal, there currently isnt a good path for moving that code to SkinComponents until core provides menu data. In the meantime, this patch reduces code complexity and prevents bugs like T324638.
This approach also allows us to move user links logic from SkinVector22 to VectorComponentUserLinks.php, and ensures the user links dropdown contains multiple menus, which allows us to reuse styles from page tools dropdowns.

Expected 11 visual changes:
* minor visual change where the user links dropdown has an
additional 4px vertical padding.
This padding was originally added to the page tools dropdowns
per Alex's request, but Alex also said that dropdowns should share
the same spacing. This change makes the styles all consistent
* Order of talk and contribution links have been swapped

Bug: T289212
Bug: T319356
Bug: T328954
Change-Id: Iac0586893fec26a8a6c2c904ce08fbf1e19b339c
2023-02-09 13:37:17 -06:00
bwang c6f1153bcc Remove button styling from log in link
Bug: T289212
Change-Id: If0181aa07cf30ffa6e67a73a983b23be4d6a7064
2023-02-07 15:57:39 +00:00
bwang 766249492f Move Log in link to overflow menu
Bug: T289212
Change-Id: I585bf644eeb68832cb0db079abd9f34256c0a1fe
2023-02-06 17:15:49 -06:00
Jon Robson 55bb37f2ab Moves feature classes from BODY element to HTML element
Move feature classes to HTML element - this is significant
for anonymous as placing the classes on the body tag breaks
the browser's ability to parse the article concurrently
with the stylesheet download, because inline scripts
are spec'ed to be able to see document.styleSheets.

Changes:
* Feature classes are moved from BODY tag to HTML tag
* For now disable localStorage storage until we've worked out
the storage mechanism in core.

Bug: T321498
Change-Id: Id5afe2c60dc0067e7c74433eda5cd7858f54b0d7
2023-01-24 18:22:13 -06:00
Jon Robson 7f0b5fe305 Dead code elimination: updateDropdownMenuData
* updateDropdownMenuData is removed. Although it was running
inside legacy Vector, it didn't do anything as legacy Vector has
no concept of collapsible items or icons.
* updateLinkData is no longer used.

Also:
Document where other methods are being used.

Bug: T320927
Change-Id: I5b40075db91b1d0f20c21bd7cf858fdfcff96538
2023-01-12 00:33:28 +00:00
bwang 6c817e932f Use features.js for main menu pinning functionality
- Register new feature for main menu pinned
- Update UserPreferenceRequirement to optionally handle default config values
- Add nav landmarks for the main menu

Bug: T317900
Change-Id: I8fc6e0a79a1155d68afb9e33e5101a2a160dc4e5
2022-12-16 12:56:54 -06:00
bwang 81348a659c Remove TOC AB test code
While removing this we also noticed that we check the value of
isMainPage. This doesn't seem like a good idea as most main pages
do not have a table of contents, so it seems like adding
unnecessary complexity for a state that doesn't exist in practice.
The existing code path also doesn't work as it adds a table of contents
unstyled to the page.

Bug: T324874
Change-Id: Idaeff6ace5912ea74ed9d335526027c4690ac8fa
2022-12-09 16:07:52 -08:00
Nicholas Ray 24055a6752 Set default pinnable state for page tools
* Leverage the infrastructure around feature management to handle the page tools
pinning and persistence

* Make pinnableHeader.js leverage features.js if the data-feature-name attribute
is set

* Sets tests/.eslintrc.json ecmaVersion to 2018 to enable destructuring in test
files.

* Adds a isPinned helper method to pinnableElement

* Add a logged in requirement so that the pinned feature is disabled for
anon users.

Bug: T322051
Change-Id: Ib86282216882fa94e37b7088a3f4bd0c1bcf6cd4
2022-12-08 14:44:07 -07:00
Jon Robson 7c24aa46fb Drop the VisualEnhancementsNext feature flag
Bug: T320101
Change-Id: I6d536af034dafd66c6478183de8029be9ed3e8b7
2022-11-21 13:27:34 -08:00
Jon Robson 5205378a8e Enable VisualEnhancementNext
Additional changes:
* More defensively check for link-class which may or may not
exist on menu items

Bug: T320101
Change-Id: Ifbd913c82933d9a8cc276d070b2b3f3ebb77c9c1
2022-11-09 17:58:14 +00:00
Jon Robson 33a67b226c [Technical] Drop redundant isLegacy logic
It's no longer needed (hurrah) once we move
search logic into individual skins. This
will also make a difficult to add additional code
to SkinVector going forward supporting our goal
of removing it.

Bug: T319349
Change-Id: I595356db449572e5fb914b909d9624f25fc2d808
2022-11-04 17:47:14 +00:00
Jon Robson 614da1dc5e Features: Make max width a feature
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
2022-10-24 13:12:06 -07:00
jenkins-bot 2164b6ef95 Merge "Use WebRequest directly in Hooks::shouldDisableMaxWidth" 2022-10-21 23:19:21 +00:00
Umherirrender 3ad2d58ac8 Use WebRequest directly in Hooks::shouldDisableMaxWidth
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
2022-10-21 20:21:40 +02:00
jenkins-bot 099e0278b9 Merge "Add vector-tab-noicon class to tabbed menus when menu items are added by gadgets" 2022-10-21 16:04:13 +00:00
Nicholas Ray 97147857b2 Add vector-tab-noicon class to tabbed menus when menu items are added by gadgets
* 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
2022-10-20 18:21:58 -06:00
Func 9afe5a6e87 i18n: Rename some messages to follow common practice
We usually prefix the message keys with the skin/extension name,
and use label/help/tooltip as postfix when needed.
The naming of the tooltip above is limited by Linker::tooltip(),
so not able to rename it. Maybe some work is needed in the core.

Other languages' work will be follow-up by the translation bot.

Bug: T319447
Change-Id: I3c88871540b7668f1699fe3a86a8146f97ff5282
2022-10-19 20:22:02 +08:00
Func e23ec1d0fa Follow-up 76d1135: Use better practice in the code
* The new preference should be prefixed with 'vector'. This is only
  for use in vector skin

* Use registration instead of the hook to set the default user
  preference. For non-dynamic defaults, registration in skin.json
  is preferred.

* Remove the 'wp' prefix for 'hide-if' parameter of field descriptor.
  The core did try to strip the 'wp' prefix when mismatched, which is
  only for backward compatibility.
  Field name without prefix (which is the key of the field descriptor)
  should be used instead.

Bug: T319447
Change-Id: I25aa0cb23b78cf06f77fb20207dee7e1742d0ca7
2022-10-18 03:26:30 +00:00
Moh'd Khier Abualruz 76d1135810 Create user preference to turn fixed width on and off
Additional changes:
* Move static classes (skin-vector-legacy and vector-toc-not-collapsed)
to skin.json

Bug: T319447
Change-Id: I3525f8bfe27445e3af83ce5cd34b4da643178fe2
2022-10-17 20:02:39 +00:00
Roan Kattouw 5693594bd1 Remove $wgVectorSearchHost, replace with $wgVectorSearchApiUrl
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
2022-10-07 00:57:58 +00:00
Jon Robson 508d5fc548 phan: Suppress error on Vector master blocking commits
Change-Id: Ib864f4c901db2b589a0f71228154487f9128b0bc
2022-10-07 00:40:50 +00:00
Jon Robson d8f242c046 [Visual enhancements next] Restores the badge styling to Echo
Currently clicking on icons will result in the icon changing
style. This is fixed in the follow up patch
I4a0637fc19cf07d545b75fa55e15010b74fc474f

Bug: T257143
Change-Id: Ief51ac0bcab20fc87edf747b5347a5ef9dfdf36f
2022-09-27 23:11:45 +00:00
Jon Robson 7ebcf3ccff Limit upgrading of Echo icons to Visual enhancements feature flag
Currently we appear to be applying our icon/button enhancements to
notifications menu if the icon field is present.

These fields are not provided yet, but soon will be, so limiting
to the feature flag.

Bug: T257143
Change-Id: I2cf49a24f2db632e3ca23f749064929678bc8e19
2022-09-14 23:00:34 +00:00
bwang fc9fe5e719 Add vector-toc-not-collapsed class serverside
Visual changes:
* No reflow on startup

Bug: T316964
Change-Id: I17f2699fec113d92b3f0f223c357654f52eb7eb3
2022-09-08 22:43:56 +00:00
Jon Robson 97cf735de2 Icons: Watchstar and wikilove are upgraded
Can be tested by appending ?vectorvisualenhancementnext=1
to URL

Bug: T310838
Bug: T234990
Bug: T234550
Depends-On: I76d0d94c9006cc5f5680849ecdd1c382c16e34ba
Depends-On: Ib7c3021db014827b4b88cac855afc0b54a360f8c
Change-Id: Ie2ffa5c3ecf270c1bb1f315937023ae7ace5ed30
2022-09-08 19:43:35 +00:00
Jon Robson 742f659b10 FeatureManagement: All features have an associated class on the body tag
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
2022-09-01 22:09:48 +00:00
bwang 3881820483 Follow-up: Refactor button/icon class helpers, make portlet classes consistent
- 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
2022-08-23 19:18:03 +00:00
jenkins-bot 310bf970bd Merge "Remove .mw-ui-button styles from user-links overflow menu" 2022-08-10 07:39:39 +00:00
jenkins-bot 6129fef3a0 Merge "Allow preview on certain article titles" 2022-08-09 16:02:46 +00:00
Jan Drewniak 5676097135 Remove .mw-ui-button styles from user-links overflow menu
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
2022-08-08 22:12:07 -04:00
Clare Ming eb597645c3 Refactor TOC A/B test to bucket users on backend
- 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
2022-08-08 15:50:28 -06:00
Jon Robson d771a1d60d Allow preview on certain article titles
The list is exposed in mw.config so banners can work out if the
preview mode is active.

We change the skin the same way MobileFrontend changes the skin.

Bug: T314286
Change-Id: Ib3c90d2640f2fa8cac17514b59aa720e4aba6d96
2022-08-08 19:58:07 +00:00
bwang 37149c9e67 Remove custom rendering of the user links overflow menu in favor of using 'vector-user-menu-overflow', a vector specific menu bucket in Hooks.php
- 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
2022-08-01 20:18:46 +00:00
Clare Ming 28732cf4f7 Remove Table of Contents feature flag
- 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
2022-07-21 12:41:39 -06:00
Roan Kattouw ce77018b7c Search: Use Codex and Vue 3 instead of WVUI and Vue 2.
[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
2022-07-18 12:54:47 -07:00
bwang 4ab798441e Refactor SkinVector to use Hooks::updateMenuItems code to process menu data
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
2022-06-28 21:53:51 +00:00
Sam Wilson 87e4ca9a21 Exclude from max-width via query string patterns
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
2022-06-01 10:00:39 +08:00