Commit graph

1059 commits

Author SHA1 Message Date
Ammarpad 02dfbd4acb Do not show empty user links dropdown in private wikis
In situations where anon account creation is disabled or when
combined login link would be used, the usermenu array contains
single element (for 'login' or 'login/create') instead of two
elements ('login' and 'create account' items separately)

If $wgWikimediaMessagesAnonDonateLink is enabled through the
WikimediaMessages extension, the third element 'sitesupport'
exists, making the number of anon items either 1 or 2 or 3.

This patch fixes $isDefaultAnonUserLinks variable to account
for all the cases

Additionally, if even login is disabled, the element count can be
zero and in such case we need to hide the dropdown in all cases
(not only on large viewports) because it would always be empty.

This patch passes the userlinks count to ::getDropdown() and adds
CSS class when appropriate to hide the drowpdown completely.

Bug: T332743
Change-Id: I1ce5e1ea30917a6e80ef00f3c1703cbd0ecb6968
2024-11-04 11:35:23 +01:00
Reedy 621484ca7b Use explicit nullable type on parameter arguments
Bug: T376276
Change-Id: Ic96b569cb73534d00f2ccd43829235351c6889c3
2024-10-28 22:22:03 +00:00
jenkins-bot b4679fe6e0 Merge "Make Donate collapsible into user links dropdown, and make header more responsive" 2024-10-23 01:47:08 +00:00
Umherirrender 69ece78cb1 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: I46fc796ec98e53070eb9edbede9eca67cc3a15a5
2024-10-20 14:01:19 +02:00
bwang 476ac6962f Make Donate collapsible into user links dropdown, and make header more responsive
Bug: T375903
Bug: T375901
Depends-on: I52c1dde47fb46bba7cd62d0fa28cba2c77b0c9e6
Change-Id: I48b439f6e6f573172f3d334c1816cf84be675b24
2024-10-16 11:21:56 -05:00
thiemowmde d95baa48da Turn if…return true…else…return false into boolean expressions
Does the same as before.

Change-Id: I8e594f69e435ae48c459bf95dfd2e6d06e9f347d
2024-10-09 09:46:50 +02:00
Jon Robson 3fbf5b49f0 Drop unused code relating to old limited width toggle.
Follow up to Ie2617e2fa83b6a888a7a2799cc39f048731dc60d

Bug: T367591
Change-Id: I270f1902f40946f31de29777735dee2e10ebfebe
2024-09-11 00:12:59 +00:00
ksarabia ae6f0d5486 Remove old limited width toggle
* Removes js
* Updates bottomDock style rules
* skin mustache updated
* Remove appearance feature flag - show appearance menu
to all users.

Bug: T367591
Change-Id: Ie2617e2fa83b6a888a7a2799cc39f048731dc60d
2024-09-03 11:25:23 -07:00
Jon Robson 3c7d7c673e Add tooltip to appearance menu icon
Bug: T369849
Change-Id: If3a73746dce41f3659f61c68941ed3ed6ebb6fd1
2024-08-27 23:06:16 +00:00
Jon Robson acb79c5e1b Improve documentation for how feature manager classes work.
This changes nothing about the existing classes, it just improves
how they are documented.

The FIXME comment was making things confusing.

Make sure every feature class is accounted for and audited and
throw a RuntimeException if we forget to document it.

Change-Id: I9d8f6553fe6b8c2ae80d8b2490c8895a8334a537
2024-08-08 20:19:48 +00:00
jenkins-bot 2f92e61a13 Merge "Inject service LanguageConverterFactory into VectorComponentVariants" 2024-06-24 18:32:00 +00:00
Jon Robson 464e0cac68 Do not show preferences, if night mode or appearance menu is disabled
Follow up to Ic40da2af8ea46bd42cbebbdbceda2431bd8600ae
Only show these if the feature is available for the current user,
otherwise, we are effectively shipping these features to all logged in users.

Bug: T341278
Change-Id: I99c28af807fbf7bbf575b8d4712e1dbad364ec63
2024-06-18 14:11:53 -08:00
Jon Robson 0f594e0af7 Make all frontend stored preferences global
Additional change:
* Delete some unused messages

Bug: T341278
Depends-On: I254d7d883771dbd394ba97799d731012f7aaaefc
Change-Id: Ic40da2af8ea46bd42cbebbdbceda2431bd8600ae
2024-06-18 16:37:53 +00:00
Fomafix c9408c027e Inject service LanguageConverterFactory into VectorComponentVariants
Change-Id: I0e1fa5a8f8f6705e2439bdbc914b9d80b0072c30
2024-06-14 11:23:51 +00:00
Umherirrender d3b251de52 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I84dc0ec8a909fce94db2b958eadac9caf661972b
2024-06-10 22:28:40 +02:00
Jon Robson 78136827ce Vector and Vector 2022 no longer share site styles or scripts
Bug: T365771
Change-Id: I508eeb143ecd0a972e2b8790ca2b5982b1d83e71
2024-06-03 18:13:28 +00:00
jenkins-bot 03fd09ff1b Merge "remove redundant HTML roles" 2024-05-29 21:06:23 +00:00
Novem Linguae 158269333d remove redundant HTML roles
Fixes 9 warnings generated by https://validator.w3.org/nu/

- The navigation role is unnecessary for element nav.
- The main role is unnecessary for element main.
- The contentinfo role is unnecessary for element footer.

Bug: T365938
Change-Id: Ibdbe70900f9a85d904252ad8ac26e4bb6e813a1c
2024-05-29 15:25:33 -05:00
jenkins-bot 5340f59b61 Merge "fix 3 empty HTML ID attributes" 2024-05-28 22:59:49 +00:00
Novem Linguae 3f5dd3c066 fix 3 empty HTML ID attributes
HTML validator says these are errors.

Before: `<button id="" class="foo">`

After: `<button class="foo">`

Bug: T365938
Change-Id: I9450eaaaa79c5aaf8f54b34effff04fba80cd450
2024-05-28 09:03:52 -07:00
Novem Linguae 4f609e6ba1 fix double id="p-variants"
Should only have one HTML ID per page. I've decided to remove
the first of the two duplicate IDs and to replace it with
#vector-variants-dropdown, to match the code style of the similar
#vector-user-links-dropdown

Bug: T343730
Change-Id: I6abdc293c1dbb18faf9751b4633a572a019593ab
2024-05-28 15:19:18 +00:00
weebney 6dcb40447d Fix missing span tag on ToC items
There is a missing span tag in the table of contents where text is placed directly into a div, breaking convention.

Change-Id: I12280e2c6a6e688b36a906d5b5a5c5deba42c977
2024-05-24 11:29:06 -07:00
Jdrewniak 607e6b39c5 Revert "Add exclusion behaviour for "width" option in Appearance menu"
This reverts commit ff5a61e9c6.

Reason for revert: The behaviour introduced in this patch needs some more consideration.

Bug: T364015
Change-Id: Ieab4ca4084df4f1b5c942fe81c7fb99b058e0623
2024-05-23 23:51:46 +00:00
Fomafix 94d1bee402 Simplify PHP code
* Use !== instead of !=
* Avoid else after return
* Use falsey check for object is null
* Use consistently spaces inside of brackets

Change-Id: I2928664acbab315ab3eae38c74f87b019d46cf29
2024-05-20 18:23:48 +00:00
jenkins-bot c570ec099d Merge "Optimize styles" 2024-05-17 18:30:33 +00:00
Jan Drewniak ff5a61e9c6 Add exclusion behaviour for "width" option in Appearance menu
- Adds the notice "This page is always wide" and disables
  the inputs for the "width" options in the Appearance menu
  when pages are excluded via configuration ( `$wgVectorMaxWidthOptions`).
- Changes layout behaviour so that pages in the
  $wgVectorMaxWidthOptions['exlcude'] configuration
  stretch the entire viewport width.
- Stops the width settings in the Appearance menu from
  being hidden on smaller resolutions.

Bug: T364015
Change-Id: Idee294adf3b309e03834276ea75e4ae43b0cffcb
2024-05-17 17:58:19 +00:00
Jon Robson 1d17b4624f Optimize styles
1) Icon optimizations
* Load styles for expand icon in
JavaScript since it relates to table of contents and that is only
enabled with JavaScript
* Drop vector-icon--x-small class since it only applies to this icon
* Remove some FIXMEs to an issue that has already been fixed
upstream

2) Move styles that do not need to be render blocking to skins.vector.js
* Move sticky header to skins.vector.js since it doesn't work without
JavaScript
* Move popupNotification to skins.vector.js since this is never server
side rendered.

Change-Id: I98e6c0826b514aaefcf88f66275bba37125129b1
2024-05-17 16:26:16 +00:00
Jon Robson 176a6397ce Correct behaviour of ConfigHelper, add tests
Bug: T365084
Change-Id: I220990554d0a07642dd03a0c7bd53f9bd7ff55ec
2024-05-16 08:04:45 +02:00
Moh'd Khier Abualruz 37e8e4c929 feature(Vector): Add configurable font size exclusions
This patch introduces the ability to configure font size exclusions
for specific pages within the Vector skin, ensuring certain pages
always use a small font size. This change is part of ongoing improvements
to the Vector skin's customizability features.

Changes:
- Updated `skin.json` to include `VectorFontSizeConfigurableOptions`
- Added new i18n string `vector-feature-custom-font-size-exclusion-notice`
- Modified logic for font size exclusion handling in `FeatureManager.php`

Additional Notes:
- Affects testing and beta deployment environments, ensure relevant
  settings are updated in `LocalSettings.php`.
For testing and on beta deployment, these settings should be set in
the LocalSettings.php of the environment, example:

$wgVectorAppearance = [
    "logged_in" => true,
    "logged_out" => true,
    "beta" => true
];
$wgVectorFontSizeConfigurableOptions = [
	"exclude" => [
	"namespaces" => [ -1, 2, 6, 8, 10, 14, 100, 710, 828 ],
		"querystring" => [
			"action" => "edit|submit|diff|info|protect|delete|undelete|diff|history",
			"diff" => ".+"
		]
	]
];

Bug: T364887
Change-Id: I23b9c4fb63f35c7d27544197fead3ad7619c67f1
2024-05-15 19:19:38 +00:00
jenkins-bot e27ef588fb Merge "Mark night mode as a valid beta feature" 2024-05-14 22:15:26 +00:00
Jon Robson 2d4f0a86d2 Mark night mode as a valid beta feature
This was not well documented but it seems that anything that
can be a beta feature needs to be added to this constant for it
to function as a beta feature.

Bug: T363814
Change-Id: I556114c65d9507829d9eb737edf09245ae14c0f4
2024-05-14 13:43:00 -07:00
Jdlrobson b7743a1dbe Revert "Add exclusion notice for "width" option in Appearance menu"
This reverts commit 89c250c18e.

Reason for revert: We need some more time to test this one and
the resulting behaviour. After discussing this morning we decided
to remove from the next train release.

Bug: T364015
Change-Id: I0dfc17d9c8a8697b8b4f590acdbc2d2c54de9429
2024-05-13 21:33:49 +00:00
Fomafix ca5c48052f Replace WebRequest::getText by WebRequest::getRawVal
The Unicode and line break normalizations of getText are not needed
here.

Change-Id: I53974627aec4b1b6724abb128a10c2a8d64059a9
2024-05-11 08:41:45 +00:00
Jan Drewniak 89c250c18e Add exclusion notice for "width" option in Appearance menu
Adds the notice "This page is always wide" and disables
the inputs for the "width" options in the Appearance menu
when pages are excluded via configuration ( `$wgVectorMaxWidthOptions`).

Bug: T364015
Change-Id: Ie99b41c9130f496ab23b60c95e551a9ea602d5a0
2024-05-09 16:47:07 -04:00
Fomafix d7735c8d57 Use context of FeatureManagerFactory in FeatureManager
Change-Id: I5e77b6ce2df1245e8a5c710b7e84813f04a77ae2
2024-05-07 18:49:06 +00:00
Fomafix 6320921bd4 Inject service UserOptionsLookup into FeatureManager
Change-Id: I3a056731c4a4e970cae0b974dab574bdbb0401f5
2024-05-06 20:07:58 +00:00
Jon Robson 55e6dfd81c Fixes: exclusion logic for anonymous users
Bug: T364159
Change-Id: I7c7e9cff7b99f8e37f3f1ffb93464fd3f31c799b
2024-05-06 12:20:40 -04:00
Jon Robson ca0d404e50 Enable night theme in Vector
- New night theme added via Codex `.cdx-mode-dark();` mixin.
- CSS custom properties separated from skin.less.
- Font-size rem conversion removed since Codex now uses rems.
- bundlesize increased by 1kb ( followup from
Icfcb5c7418061a5727580f0685054356ba4edb72 ).
- Icons that use background-images are inverted for night-theme.
- Linter error fixed for long-lines in clientPreferences.js

Co-Author: <Bernard Wang> bwang@wikimedia.org
Bug: T354889
Depends-On: I1f54bf4f144eaec6ed317c04bd0c851c2f01b42c
Change-Id: I3a8a147b6be67bc830f0d3b816a4b85c26f99cf1
2024-05-02 13:22:59 -05:00
jenkins-bot c3987d472b Merge "Rename client preference menu to appearance menu" 2024-04-29 20:41:19 +00:00
bwang 0109218ab9 Rename client preference menu to appearance menu
Bug: T362808
Change-Id: Id6800d38eebf433cf0c9e3f179dd83df2eefd1fb
2024-04-29 15:38:20 +00:00
Jon Robson 3c01ccc9f0 Wrap sitenotices in core
Depends-On: Ib48b1f54c326a0363841b2f592d8fd4cf7312b9b
Bug: T361966
Change-Id: I14cab105a798a5c9e615892c3305bfbd459a7a51
2024-04-24 17:12:26 -07:00
jenkins-bot f6c0071bd7 Merge "Add exclusion notice for night mode feature" 2024-04-17 16:44:03 +00:00
Jan Drewniak a3801497b9 Add exclusion notice for night mode feature
If night-mode is disabled on a certain page via the
exclude list in skin.json, then the following class:
".skin-theme-clientpref-excluded" will be added to the HTML element.

In this scenario, the related client-preferences
menu options are visible, but disabled, and a notice
is rendered below the options informing users of this state.

Bug: T361158
Change-Id: I46d335d079a2d27c7a4122e23ac7e479c286b886
2024-04-16 22:38:35 -04:00
bwang c69a53a16c Use client preferences for appearances menu
Bug: T361586
Change-Id: I636a557e724f23ea18da135bac59cb304ba81091
2024-04-15 22:36:48 +00:00
Moh'd Khier Abualruz 1fbdc0828a Accessibility settings menu should default to open for all users
Refine Feature Management in Vector Skin, in this patch we simplify the feature management criteria within the Vector skin by adjusting the requirements for the Constants::FEATURE_CLIENT_PREFS_PINNED feature. By removing the Constants::REQUIREMENT_LOGGED_IN constraint, we aim to enhance and unify the user experience by making certain preferences more accessible to users, regardless of their login status.

Changes:
- Updated FeatureManagerFactory.php by removing the Constants::REQUIREMENT_LOGGED_IN from the list of requirements for Constants::FEATURE_CLIENT_PREFS_PINNED. This modification aligns with our goal of making the Vector skin more user-friendly and accommodating to both logged-in and anonymous users, ensuring a broader range of users can benefit from customized features and settings.

Rationale:
The decision to remove the login requirement for accessing certain client preferences stems from an ongoing evaluation of user engagement and feedback, as detailed in Phabricator task T360099. This change is part of a series of improvements aimed at enhancing the accessibility and usability of the Vector skin, making it more adaptable to the diverse needs of our user base. By enabling more features for anonymous users, we anticipate an increase in engagement and a more personalized browsing experience for all users.

Bug: T360099
Change-Id: Ic477cd66df34c1caeb822d8d2162a7299cd648a0
2024-04-01 05:49:36 +02:00
jenkins-bot b98e0a0017 Merge "Allow disabling of night mode on certain pages via config" 2024-03-29 08:03:00 +00:00
Steph Toyofuku feb8cc90dc Allow disabling of night mode on certain pages via config
* Using the new ConfigHelper, support disabling night mode on certain
pages via configuration options
* In addition, adds test coverage for this case and the query parameter
case (in a new integration test file as we now require accessing the
service container for request context)
* Finally, supply a default configuration in skin.json with all the
values set to null

For the easiest possible approach while we evaulate our general feature
management system, this logic is handled inside of getFeatureBodyClass
using the new shouldDisable general function.  In the future, it may
make sense to break this out into its own requirement class, but for now
that feels premature

Bug: T359606
Change-Id: I3e7a4720ec3cc2afd9777e36f59aa56b682258f0
2024-03-28 16:37:30 -07:00
Steph Toyofuku 3387ef3ee4 Add tests for ConfigHelper
This class is being used in both vector and minerva, and we are
currently depending on it working for our night mode rollout, so let's
add some test coverage!  Also fixed a small spacing issue in production
code that was bothering me lol

Note: these are not totally exhaustive - next steps would be to ensure
that the exclusions/inclusions work with arrays and not only single
elements, but hopefully this helps build some confidence ☺️

Change-Id: Iebea43eae6b1517fd778763db4f5db3b0fd9c30f
2024-03-27 16:49:39 -07:00
jenkins-bot 9a362f52cd Merge "Vector - Rename the skin night mode classes to more readable classes" 2024-03-21 00:19:29 +00:00
Moh'd Khier Abualruz b3ab84f9e5 Vector - Rename the skin night mode classes to more readable classes
The classes:
- skin-night-mode-clientpref-0
- skin-night-mode-clientpref-1
- skin-night-mode-clientpref-2
is being replaced with
- skin-theme-clientpref-day
- skin-theme-clientpref-night
- skin-theme-clientpref-os

Other Changes:
- Change vector-night-mode preference to vector-theme
- Add skin-theme-os-label and other messages to skins.vector.clientPreferences
- Remove skin-night-mode-* messages from skins.vector.clientPreferences

Bug: T359983
Change-Id: I31eb086e623a97df9fbd004425559e05b0cae170
2024-03-20 23:54:47 +00:00