Commit graph

254 commits

Author SHA1 Message Date
Jon Robson 6636367d47 [Components] Introduce VectorComponent and MainMenu components
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
2022-11-01 17:01:51 -07:00
Jon Robson 31b0fd08d2 [Technical] Prepare for template rename
The user links and language button are SkinVector22 features but
they are buried inside SkinVector.

When we rename the templates this code will become problematic
as SkinVector22 requires these modifications

Bug: T319349
Change-Id: Id5e5b97af0ea020ef20565a7e1acc685d7be0892
2022-11-01 03:45:21 +00:00
Jon Robson 41ed1cc525 [Technical] Separate shouldHideLanguages from isLegacy logic
Bug: T319349
Change-Id: I640533dc7ee3b39157963024eae11dca583606cd
2022-10-31 22:53:46 +00:00
Jon Robson fbe5bdedb7 [Technical] Unset toc inside SkinVectorLegacy
Additional change:
* Remove unused isLegacy method

Bug: T319349
Change-Id: I87e9f886f308eb7574b2b8b482956dec9409d119
2022-10-28 15:43:39 +00:00
jenkins-bot 59e8ab5402 Merge "[Technical] Move isSidebarVisible and template boolean to SkinVector22" 2022-10-28 15:14:37 +00:00
Jon Robson 8ec5a51625 [Technical] Move isSidebarVisible and template boolean to SkinVector22
Additional change: Prefix with "is-" per template coding standards

Bug: T319349
Change-Id: Iadf149439d043d00a79094c4f34dfbea92abffe1
2022-10-27 18:45:47 +00:00
Jon Robson a1199a0917 Use standard utility classes for flushing icons left and right
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
2022-10-26 10:01:12 -07:00
jenkins-bot 598424b2e2 Merge "Replace incorrectly mw- prefixed classes Rename template and CSS files to match updated naming conventions, replaces instances of "sidebar" with "main menu"" 2022-10-25 22:32:06 +00:00
bwang 51457a78e7 Replace incorrectly mw- prefixed classes
Rename template and CSS files to match updated naming conventions, replaces instances of "sidebar" with "main menu"

Bug: T316570
Bug: T317437
Change-Id: Ib4050768f20b1734d356104f18aa539f657099d8
2022-10-25 10:28:31 -05:00
jenkins-bot a7abe4d201 Merge "Fix Vector 22 missing user menu on private wikis" 2022-10-21 17:54:56 +00:00
Nicholas Ray 990392cdeb Fix Vector 22 missing user menu on private wikis
When `$wgGroupPermissions['*']['edit'] = false;` is set, an `emptyPortlet` class
is added to the user menu which prevents the menu from showing even though it
contains a login link.

Changes:

* Vector-22 now determines what classes are applied to the user menu's container
instead of core deciding that on Vector's behalf (L761 of
SkinVector::getUserMenuPortletData). This eliminates the undesirable
`emptyPortlet` class. This can potentially be removed upon completion of
T319356.

* Conditionally renders the learn more link based on whether
$userMenuData['is-empty'] is `true` so that we don't show the learn more link
when the anontalk and anoncontribs menu items aren't present.

Bug: T317789
Change-Id: I883926c36f59d446076f960ead31f82e51967e70
2022-10-20 17:12:10 -06:00
jenkins-bot daaa5667a4 Merge "Remove $isDropdownItem param from SkinVector::getCreateAccountHTML" 2022-10-04 17:19:54 +00:00
Jon Robson 4b17edadd7 Fixes to addPortletLink hook handler
* 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
2022-09-30 20:37:01 +00:00
Nicholas Ray 849e63b798 Remove $isDropdownItem param from SkinVector::getCreateAccountHTML
The SkinVector::getCreateAccountHTML method only had one caller which always
passed `true` for the $isDropdown argument. Therefore, we can remove this param
and always assume that it is a dropdown item.

Bug: T317789
Change-Id: I19ceecbac152d1399ab323ab14e07db9dc82c244
2022-09-30 14:03:02 -06:00
jenkins-bot d59885cf89 Merge "Enable related tabs on Vector" 2022-09-01 20:36:15 +00:00
jenkins-bot 62c0b80d4f Merge "Change ULS label for sticky header when 0 Languages available." 2022-08-30 21:45:58 +00:00
Jon Robson 486748ac41 Enable related tabs on Vector
Depends-On: I861e8fe9c80569224548b8569452f8c57a446998
Bug: T313409
Change-Id: I871291c91dfe1f92c1131a2403695394ef3d0533
2022-08-30 14:20:11 -07:00
Jan Drewniak 87d0630aa2 Change ULS label for sticky header when 0 Languages available.
Modifies the `getULSLabel()` function to centralize the logic
related to the ULS language button messages.

Renames this function `getULSLabels()` since it retrieves both
the text and aria label for this input.

This logic conditionally returns the values based on whether
or not there are multiple languages available for an
title. It method is used in both sticky header and language
button near the page title.

Bug: T315556
Change-Id: I47e313414ae9c86d057e9b65ec67e522e9e7c464
2022-08-30 11:12:50 -04: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
bwang 006ea3517b Add collapsed TOC to sticky header by moving the TOC
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
2022-08-11 11:25:21 +00:00
jenkins-bot a4949503f6 Merge "Update #siteSub, #contentSub and #contentSub2 to fix spacing, conditionally render #contentSub and #contentSub2" 2022-08-03 20:16:51 +00:00
bwang b89307c6bb Update #siteSub, #contentSub and #contentSub2 to fix spacing, conditionally render #contentSub and #contentSub2
Visual changes:
- Reduced spacing above #siteSub
- Updated spacing from #contentSub and #contentSub2

Bug: T311421
Change-Id: I7fd78d2c92007b231cfc49af0fbd02a4f74f3901
2022-08-03 01:14:30 +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
jenkins-bot e4b4f5bf9f Merge "Show ULS button when article exist only in single language" 2022-07-27 20:22:02 +00:00
Ed Sanders 23a5261ef6 Add "Add topic" button to sticky header
Bug: T304187
Change-Id: Ib497eb91ec7548e2ba6d1d474a196ada770f955d
2022-07-26 22:15:02 +00:00
Ed Sanders c9a04099d0 Sticky header: Add a link to the 'subject' page when on talk pages
The subject link does not have a consistent ID like the talk link,
so it needs to be computed from the canonical namespace name.

Something similar is done in VE.

Bug: T309424
Change-Id: Ie82ca61aef30204edd09793963b25464febb17fe
2022-07-22 22:24:38 +01:00
Santhosh Thottingal 40f6c5e29d Show ULS button when article exist only in single language
When the article exist only in one language, currently we do not show
language selector. This prevents showing the entry points to create article
in other languages by various means.

Show the language selector so that options like translate, interlanguage
links, language settings can be shown.

Bug: T275147
Bug: T290436
Depends-On: I42c5d44ec15e291d71723c9738ddb8f0d1cf0b09
Change-Id: I7fb68457c1203d824fe7433c9f272f300a483c44
2022-07-21 16:28:22 -07:00
jenkins-bot 3c8796ee04 Merge "Search: Use Codex and Vue 3 instead of WVUI and Vue 2." 2022-07-19 15:18:29 +00: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
Ed Sanders e2d70c383e Move code for adding sticky header class to SkinVector22.php
Per the comment at the top of the file, much more of this code
needs to be moved to SkinVector22.php, but this is causing a specific
regression, so can be moved now.

Bug: T312782
Change-Id: Ief7581782f1e4eefc7474cceb81830783dff99a8
2022-07-11 16:11:58 +01:00
Jon Robson 2a4ac3152b Move Vector menu class logic into Menu mustache template
Cleaned 'vector-menu' in SkinVector file, updated
includes/templates/Menu.mustache and includes/templates/legacy/Menu.mustache.

Bug: T290281
Change-Id: I7286fa82abfd437a228b9ac07ac781210d7cd98f
2022-07-07 12:34:23 -05: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
Jon Robson 49c8b5f514 [Fix] Adjustment to legacy menu templates
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
2022-06-22 22:42:39 +00:00
jenkins-bot dafe3c8fd4 Merge "Handle accessible labels differently for dropdown and portal menus" 2022-05-24 15:09:04 +00:00
Mo Abualruz e46eef19d0 Normalise PHP namespaces used in Vector
- `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
2022-05-23 09:32:40 +02:00
bwang 9e665f9034 Handle accessible labels differently for dropdown and portal menus
An issue was found in QA where certain browser/screenreader combos could not read `aria-labelledby`+`aria-label`. Instead, we avoid using `aria-labelledby` and the `label` element entirely and apply the accessible label directly to the `input`. This great simplifies our labelling and improves screenreader support, while also allowing us to hide the `label` element to reduce verbosity.
Because the `label` element is used differently in the portal menu, we use the `is-portal` variable to maintain the old markup for portal menus

Bug: T301051
Change-Id: I5a0f7d5d78838fabe561095b33176e7162b31aea
2022-05-12 22:11:22 +00:00
jenkins-bot ff3d879ee2 Merge "Remove nav element from Vector menus and only render label elements in Vector menus when needed. Add new nav landmarks corresponding to user links, main site nav, and article editing tools. Split out legacy Menu template." 2022-05-03 15:42:02 +00:00
Tim Starling 8d0659b1e6 Updates for core temp user autocreation feature
* Use pt-tmpuserpage for the temp user name.
* Use the userAnonymous icon for the temp user personal tools menu.
* Suppress the logout menu item for temp users.

Depends-On: Ib14a352490fc42039106523118e8d021844e3dfb
Bug: T300263
Change-Id: I8ac5de82f76a9ec58b0fbef85546bc7fd5b793d2
2022-04-28 20:32:53 +00:00
bwang d54029a523 Remove nav element from Vector menus and only render label elements in Vector menus when needed. Add new nav landmarks corresponding to user links, main site nav, and article editing tools. Split out legacy Menu template.
Bug: T291304
Bug: T301051
Change-Id: I35c20103e4b45139ef1d3f73c23f6a744aa87a3c
2022-04-27 16:52:20 +00:00
jenkins-bot cdc2df8e66 Merge "Always collapse Echo alert on "wide" headers" 2022-04-20 16:39:12 +00:00
Jon Robson 5ef40f2f73 Always collapse Echo alert on "wide" headers
Bug: T301583
Change-Id: Ib4baab3ab814a79f45d8d19cfe4e499307852d52
2022-04-19 21:02:54 +00:00
jenkins-bot 065f3409b5 Merge "Replace Action::getActionName by IContextSource::getActionName" 2022-04-19 18:11:25 +00:00
Umherirrender d0ac534749 Replace Action::getActionName by IContextSource::getActionName
Change-Id: I41bb15527e5ff9296a53205608c596291d485876
2022-04-19 10:46:48 +02:00
Mortal303 8b51041003 Move Vector menu class logic into Menu mustache template
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
2022-04-18 15:18:53 -05:00
bwang 282fe1aa51 Fix missing create account link follow up
Follow up to 58b6831

Bug: T306116
Change-Id: I2989657f871b0a312e68c4af7757029b0c9c9f24
2022-04-15 18:57:14 +00:00
bwang 58b6831e4d Rely on core to provide accesskey/title attributes, update search toggle location in DOM
Bug: T299980
Depends-on: Ide214de5f246b38689799e20db9e8a4671d9b7ac
Change-Id: I43eb04ec095cc9c1d683df9da05887595c2eddfb
2022-04-14 13:53:07 -07: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
bwang f1c70e99b7 Update sticky header to use ARIA attributes for section collapsing and add accessible label to toggle buttons
Bug: T303766
Change-Id: Idda4f286a42152af1d233588a1839ada5491ce95
2022-04-06 17:24:34 -05: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
jenkins-bot 19f114281a Merge "Drop the LatestSkinVersionRequirement" 2022-04-04 20:18:35 +00:00