Commit graph

969 commits

Author SHA1 Message Date
ksarabia 45332cfcb6 Fix alignment issue in Zebra
Addresses misalignment of client pref in zebra

Bug: T350417
Change-Id: Ib4b80b13dc67d00362abf168853c3ae58ae808b3
2023-11-16 13:53:41 -06:00
Jon Robson 4235a1f355 Theme preferences should not display when feature disabled
This was being flagged by Pixel
Follow up to I0b1ec445c4d292bbf417a39dbc5d2032b563f525

Bug: T350195
Change-Id: I7e4b7b453a518a94a75e952bdeaf4e84b23396c8
2023-11-15 16:42:11 -08:00
ksarabia 1a15dbd4d0 Fix sidebar component order
* This moves down the client pref menu
* For now when page tools is collapsed the client preference menu
is hidden. This will be revisited when we implement pinning
in the next sprint.

Bug: T350417
Change-Id: Ic94d6fd2c4ccb667b0ae602d03c564f88a14b8ec
2023-11-16 00:30:28 +00:00
jenkins-bot 7657f28701 Merge "Allow client side preferences to render in a dropdown" 2023-11-15 22:01:16 +00:00
Jon Robson 5a0678c77d Allow client side preferences to render in a dropdown
Known problems:

- For now, this can only be rendered by manually updating
the isClientPreferencesPinned local variable in SkinVector22
This will be addressed in T351141
- The icon is not correct. This will be addressed in
https://phabricator.wikimedia.org/T351142

Bug: T350195
Change-Id: I0b1ec445c4d292bbf417a39dbc5d2032b563f525
2023-11-15 12:50:54 +01:00
Gergő Tisza f1db8517a5
Update skin[-legacy].mustache type documentation
Depends-On: I8e0cf13093a0c738038a01a0ae120861642a2aa1
Change-Id: I5df124869aa3130573fdb627f5e2588beba3570f
2023-11-14 20:57:25 -08:00
Moh'd Khier Abualruz 412c1f2d83 Create a sidebar for user preferences
* Adds mustache for sidebar
* Adds file to render sidebar

Bug: T350417
Change-Id: I691c8a0487e158e96027109c223569224f03a102
2023-11-14 14:33:01 -08:00
Jon Robson 0a33ffffac Remove Zebra A/B test code
Additional change:
* Remove duplicate A/B test requirement for language in header

Bug: T339957
Change-Id: I0258e71ac0e270682ec1f3bcb0f10198892f058d
2023-11-13 21:56:34 +00:00
Jon Robson 332678a991 Fixes orange bar of doom (echo alert)
* Updates CSS selector for the Echo alert
* Prevents conversion of OBOD to a button via a generic
array of "exception" names.

Bug: T350195
Change-Id: Id9b2763fe4d893fa4b4ce1e740dba59e6d887436
2023-11-13 11:17:51 -08:00
Jon Robson 07a26a9448 Refactor VectorComponentUserLinks to not use hooks
Bug: T350195
Change-Id: I6cbf45587475f0477657a7ce9309b2cd42da33c1
2023-11-09 17:32:10 -08:00
Moh'd Khier Abualruz 9428bd2a0c Add images to Vector 2022 beta feature
- Add images to resource/images
- Use images in the config of onGetBetaFeaturePreferences for vector-2022

Bug: T349321
Change-Id: Ib359d49719dd5854c3f060f3484c098d93c35c06
2023-11-07 18:47:38 +01:00
jenkins-bot 1eb75ab7b1 Merge "Vector legacy: Support dropdown creation via addPortlet" 2023-10-25 10:15:05 +00:00
Jon Robson cb8a500e7a Vector legacy: Support dropdown creation via addPortlet
Vector:
    mw.util.addPortlet('p-twinkle', 'TW', '#p-cactions');
    mw.util.addPortletLink('p-twinkle','#', 'Hello world');

Additional changes:
* Add aria labels to gadget created menus

Additional changes to template
* Remove self closing tag on input[checkbox] in template
* Rearrange vector-menu and vector-menu-dropdown classes
for consistency between two approaches

Bug: T342815
Change-Id: I938928c3625099ad49bec8aafb11f91190a9f494
2023-10-25 10:39:30 +02:00
Umherirrender ae1584ade5 Simplify SkinVector22::isTocAvailable
No need to check $tocData for empty before checking if a key is set on
the array, as empty suppress the error when $tocData is null

Change-Id: I3f1fd4bfdfd7f29e6750d72af75c286668b5f09c
2023-10-22 16:50:22 +02:00
Umherirrender cb8fc5c8c1 Replace empty() with falsy check
empty() should only be used to suppress errors
When the type of the variable is array,
a falsy check is the same (checks for null, false and empty array)
Found by a new phan plugin (T234237)

Change-Id: I84ced7c17157b322f858640362e1013e37773d43
2023-10-22 11:45:42 +02:00
Umherirrender b962638262 Replace empty() with a string compare
empty() should only be used to suppress errors
Found by a new phan plugin (T234237)

Change-Id: I10b562aa04eb9cf974e301567e74f2f620027ba8
2023-10-21 20:26:30 +02:00
Moh'd Khier Abualruz 173c91a0f5 Make Vector feature flags compatible with beta features
- Added Key 'beta' to features config in skin.json. As usual this also supported by global configs.
- Added feature management logic to check for beta feature enabled status and the user's selection of utilising the vector beta features.
- Added VECTOR_BETA_FEATURES to Constants.php which is an array that holds features names that would be enabled.
- Removed final from class declaration of OverridableConfigRequirement class, as it does interfere with the mocking in the current setup

Remaining Work:
- Missing images to be added in the hook to show in beta features under Special:Preferences -- this will be added in a followup

Bug: T347772
Change-Id: I7bf8284e328c66c019c392f57207cab21ce0d4f6
2023-10-19 18:22:57 +02:00
Moh'd Khier Abualruz 22e97fe383 Add multiple font size to logged-in users
Read Value from user preference for logged-in users.

Depends-On: I041a0cb21e872700ceeeddd3a39922e456aa7bb8
Bug: T346954
Change-Id: I6afa39624c3cadd31632d63a36b919d641983ae6
2023-10-17 19:42:30 +02:00
Jon Robson 004b4c96f3 Add multiple font size to frontend
Use integer value going forward as it will be easier
to manage.

Bug: T346954
Change-Id: I041a0cb21e872700ceeeddd3a39922e456aa7bb8
2023-10-17 12:43:02 +00:00
jenkins-bot 48f2a52c96 Merge "Simplify TOC design for pinned TOC on no js small viewports" 2023-10-17 04:11:30 +00:00
Jan Drewniak 8a3e24e346 Simplify TOC design for pinned TOC on no js small viewports
Bug: T340571
Change-Id: Ie34d7d478b3a73cade9f5328439515e419692eb7
2023-10-16 23:31:18 -04:00
Jan Drewniak dcdcecd3db Add config option to disable Readability survery & minor fixes
Adds a config option to control the Readability prototype
survey tool on a per-wiki basis.

Minor fixes:
- Adds missing i18n messages to the tool for slider labels
- Ensures tool only runs on Vector 2022 skin
- Wraps the initialization in an IIFE

Change-Id: Ia65a0043dab5e9a23d4ef401ed83914e4f3d2882
2023-10-16 00:45:59 +00:00
jenkins-bot 6b9055e593 Merge "Allow user preferences to be overriden by query string parameter" 2023-10-13 17:33:12 +00:00
jenkins-bot 48a3efbae2 Merge "Vector sticky header dynamic edit icons order" 2023-10-12 19:18:03 +00:00
Jon Robson 411f9ce69a Allow user preferences to be overriden by query string parameter
Currently only features that are associated with LocalSettings configuration
can be overriden by query string. Going forward we'd like to expand this to apply
to user preference too.

A generic OverrideableRequirement is created.
The existing OverridableConfigRequirement is refactored to extend OverrideableRequirement
The /UserPreferenceRequirement now extends it

This allows http://localhost:8888/wiki/Spain?vectortypographysurvey=1
to work

Bug: T347900
Change-Id: I11efd6b07192d5d2333f4506e9d87a8c0638d657
2023-10-12 19:05:10 +00:00
Moh'd Khier Abualruz 0903ecba9c Vector sticky header dynamic edit icons order
Problem: Edit-links are shown in static order in sticky header always source edit 1st, then visual editor

Patch Changes:
- We now read the configuration from the visual editor extension.
- Based on the order that page views portlet shows of the tabs, we add the icons to the sticky header in the same order as it shows in the portlet.

Bug: T318447
Change-Id: I2d926bf84131b13c881b09c87ccd5d2010c0dffc
2023-10-12 18:54:47 +02:00
Ammarpad 3452647071 Hook: Create HookRunner and interface for own hook
Bug: T348040
Change-Id: I63a7e71a06729dbf607ef9bb275896e42db1b6e0
2023-10-10 22:03:43 +00:00
jenkins-bot 825e1dfad8 Merge "Preferences set to "disabled" return false when isEnabled is called" 2023-10-04 00:56:06 +00:00
Jon Robson 735dad995b Preferences set to "disabled" return false when isEnabled is called
The font size preference sets a preference to disabled rather than 0.

Rather than save this as 0, it would be useful to store this as a string
given in future it will evolve to have values small, medium, large

Change logic in UserPreferenceRequirement to support non-binary options.

Bug: T346987
Change-Id: I399aa1b1be4a45cab0aa3b8addb482e5af6c5bf3
2023-10-04 00:34:16 +00:00
jenkins-bot fd006b5f29 Merge "Add columnStart container and update grid styles" 2023-10-03 19:30:06 +00:00
Jan Drewniak d4246e6ca6 Web typography prototype survey
Creates an interactive prototype for gathering
feedback on users typography preferences.
This prototype is meant to be temporary and is
built soley for feedback purposes for the
WMF Accessibility for reading project.

The prototype code is:
- for logged-in users only
- hidden under the API user preference "vector-typography-survey"
- disabled by default

It is intended to be enabled via a banner that calls
code similar to:
    new mw.Api().saveOption( 'vector-typography-survey', 1 )

Bug: T347208
Change-Id: I8d8914a0fa16d40cb22ed0e61832bc5bbabe1c78
2023-10-02 10:56:40 -07:00
bwang 3cb6e4c505 Add columnStart container and update grid styles
Bug: T323141
Change-Id: Id6d8736922077b26fb972b6e743cf02d048e669d
2023-10-02 12:30:45 -05:00
jenkins-bot 7981c9b23e Merge "Add replace .vector-sidebar-container-no-toc with .vector-toc-available and .vector-toc-not-available" 2023-09-29 17:20:46 +00:00
bwang 11f156d5ff Add replace .vector-sidebar-container-no-toc with .vector-toc-available and .vector-toc-not-available
Bug: T318011
Change-Id: Ib07ace50e762c2e9f59e668ad6746574a60a144b
2023-09-29 16:57:42 +00:00
Lucas Werkmeister ca9ba6cc65 SECURITY: Properly escape vector-toc-toggle-button-label
CVE-2023-PENDING

The line param can contain some markup (since headings can contain
markup), so make that a raw param.

Bug: T340217
Change-Id: I9295a8e0f9f00b62d5206f6d7e40bb657f43651a
2023-09-29 09:08:57 -04:00
Lucas Werkmeister 124a4efa2f SECURITY: Catch MalformedTitleException from vector-intro-page
CVE-2023-PENDING

If the vector-intro-page message doesn’t parse as a valid title, skip
customizing the menu entry label instead of crashing. (Optionally, this
could maybe log a warning or something later.)

Bug: T340220
Change-Id: I2769c1f3115898bbe697ebe9c9c0eaf0ddc0d251
2023-09-28 23:16:30 +01:00
Jon Robson d35db97615 It should be possible to persist Vector font size for registered users
Bug: T346987
Change-Id: I01e0fac5ba781480ee32a8b32f6ef7fafb8d1ca5
2023-09-27 20:04:22 +00:00
Jon Robson 65c48d4eb2 Feature: Client preferences interface
Notes:
* This is functional but intentionally not designed until the design
has been finalized.
* A feature flag is added that swaps out the limited width toggle with
a settings cog
* The preferences module is kept in a separate ResourceLoader module
(skins.vector.clientPreferences) to make it more portable for
when we eventually want to add it to Minerva as well.
* Intentionally have not focused on non-jS version given we will
likely revise this again in a future version/upstream to core.

Bug: T345363
Change-Id: I0c793b73e0676e32f031c6168c292f63908c72e3
2023-09-15 10:03:28 -07:00
Moh'd Khier Abualruz c88d72f1d7 [anon prefs] TOC pinned / unpinned
- Status should persist across page views for anonymous users
- Added 'toc-pinned' as a persistable feature in features.js and FeatureManager.php.
- Handling for cached HTML supporting both new and old class names for pinned/unpinned TOC

Based-On: I0fbe0ab458c5bd55d659d3c35a8fbaa6cd6ec0e1

Bug: T316060
Change-Id: Iad8523037ed364f09962b2d6ca0a3d50d7bd2266
2023-09-14 21:37:50 +00:00
Moh'd Khier Abualruz 7fc6bb0a6a Update label for Page tools navigation region
- Set aria-label to read 'Page tools' in the nav elements

Bug: T330326
Change-Id: I99119aebe98b329d6d1f4e2f8c9f37f77692e8ab
2023-09-05 18:41:38 +02:00
Bartosz Dziewoński 0bb02c9c57 Only show notification after CentralAuth autologin on Vector 2022
This brings in CentralAuth for phan analysis, using config patch
8063720d68ee1d2db2c37c1ad55da3fbef688bce in CI.

Bug: T345112
Change-Id: Iddd94b38f04a34dc18df8978c2bf45e8e204a85c
2023-08-30 08:53:53 -04:00
Jan Drewniak a448233d1d Make Vector feature flag compatible with clientPrefs
Adds the `-clientpref-` string to the Vector font-size
feature flag class, which will now read:

    vector-feature-custom-font-size-clientpref-enabled

Bug: T343928
Change-Id: Iefc575229d52bea820fbee35711650408c917338
2023-08-25 14:58:30 -04:00
jenkins-bot 580b7a022f Merge "Add font size feature flag" 2023-08-24 21:33:39 +00:00
ksarabia 1805561923 Add font size feature flag
Add feature flag that for new (eventually customizable) font size.
Enabled via url param VectorCustomFontSize=1 and font size set to
a hard-coded 16px value for testing purposes.

Bug: T343928
Change-Id: I75801db7506ba2a8212df94bb2079c33a3b64614
2023-08-24 20:57:46 +00:00
gerritbot b5c38e7158 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I7283b3a22bedf6d05d0959cd6edb40b0b15c57b0
2023-08-19 04:23:07 +00:00
Jon Robson e5bf8adad7 Limited width uses new client preferences system
* Update classes to use clientpref-1 and clientpref-0 suffix for limited width
I've limited this to the only client preference for now to reduce
risk.
* For cached HTML retain existing CSS rules, and continue saving
a cookie
* Migrate cookie if found for newly generated pages. This will be
to ensure the old cookie and new cookie are in sync (this should be
a one time operation)

Depends-On: I1e635f843ac9b2f248b1f7618134598e80291b38
Bug: T341641
Change-Id: I120f8f7114b33d2cfbd1c3c57ebf41f8b2d7fec4
2023-08-04 21:31:21 +00:00
bwang eb64a09a7d Separate dropdown/menu references in PHP and templates
- VectorComponentMenuVariants.php is renamed to VectorComponentVariants.php, and returns menu and dropdown data
- Remove TabsMenuContents.mustache in favor of MenuContents.mustache
- Fix the variants dropdown to use the full Menu template

Follow-up: Idf05c1664c026f58487ba34af5ede8a11e695baf
Change-Id: I0e9b1ab3306b04ee0d226048c6885beab4f310c6
2023-07-31 14:03:12 -05:00
Moh'd Khier Abualruz 4b4fc6c6c9 Add hook support for mw.util.addPortlet method
- Hooking into mw.util.addPortlet
- merged in tests from: I3258388d74c103515e3f0680304f9a376e439a35

possible follow-ups:
- tooltips support
- custom attributes support
- Adapting portlets of types dropdown, tab to vector skin. Check patch set 10 for a starting point

Depends-on: I79bad8661e34e653d41e6cb1cd4462ac5c6bc3b1
Bug: T303488
Change-Id: I35a51df6ece2e48e086e722337d4c6bba427eeb4
2023-07-26 13:37:09 +03:00
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
jenkins-bot 565ff35779 Merge "Update html-label to use label-class" 2023-07-13 00:17:13 +00:00