Page MenuHomePhabricator

Create Dropdown and Menu Skin component classes
Closed, ResolvedPublic5 Estimated Story Points

Description

After T319349 is completed, we need to create skin component classes to organize the template data into the nested format required. While not blocking T318434, this would speed things up as well as supporting the upcoming work on T317899.

Benefits

  • Various component data is in the global scope making it harder to reason with templates and easier to break them. For example the input-location template value should be part of data-search-box but isn't.
  • Easier to upstream code from Vector to core and vice versa.
  • Component classes would match template names, making it easier to refer to the data a template has available.

GOALS

  • Removal of SkinVector class will fully isolate old and new Vector
  • Components will scope data to the component they serve
  • Components will provide a language more consistent with Vector's abstraction than MediaWiki core menu API

TODO:

Acceptance criteria:

QA steps

  • If the more menu or page tools menu is empty, the menu should not be shown

Developer notes

Rough proof of concept patches:

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
LGoto set the point value for this task to 1.Oct 18 2022, 5:01 PM

@Mabualruz can you link this to Phabricator tickets this would help? Is it possible for you to share an early WIP patch to get a sense of what this work would entail before we estimate it?

bwang renamed this task from Separate/Create components and mustache templates for menu items in vector to Create Dropdown and Menu Skin component classes, handle compostion.Oct 31 2022, 3:02 PM
bwang raised the priority of this task from Low to High.
bwang updated the task description. (Show Details)
bwang renamed this task from Create Dropdown and Menu Skin component classes, handle compostion to Create Dropdown and Menu Skin component classes, handle composition.Oct 31 2022, 6:48 PM

@bwang @Jdrewniak While analyzing T317899 I wondered if we could handle composition by more simple means?
https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/852317 is an example of how we could split the dropdown component into 3 templates to allow us to easily inject different types of content.

ovasileva lowered the priority of this task from High to Medium.Nov 3 2022, 5:29 PM
Jdlrobson renamed this task from Create Dropdown and Menu Skin component classes, handle composition to Create Dropdown and Menu Skin component classes.Nov 3 2022, 9:01 PM
Jdlrobson updated the task description. (Show Details)
LGoto renamed this task from Create Dropdown and Menu Skin component classes to [L] Create Dropdown and Menu Skin component classes.Nov 15 2022, 6:33 PM
LGoto updated the task description. (Show Details)

@Jdlrobson So the new dropdown component class will be used for both the original "Dropdown.mustache" and "PinnableDropdown.mustache"? i.e. does it need to support two types of dropdown template data? Or should we consider updating the original dropdowns to be in line with our new dropdown data (i.e. 'data-menus')?

bwang updated the task description. (Show Details)

Change 858435 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] [Refactor] Rename Dropdown.mustache to LegacyDropdown.mustache

https://gerrit.wikimedia.org/r/858435

@Jdlrobson So the new dropdown component class will be used for both the original "Dropdown.mustache" and "PinnableDropdown.mustache"? i.e. does it need to support two types of dropdown template data?

I was imagining there would be two classes Dropdown and PinnableDropdown corresponding with those templates with a class inheritance or trait to tie the two (PinnableDropdown is Dropdown + some extra data).

Or should we consider updating the original dropdowns to be in line with our new dropdown data (i.e. 'data-menus')?

I don't think Dropdown needs data-menus. I would prefer us to have a LegacyDropdown class that uses Dropdown and supplies html-before-portlet, html-items and html-after-portal. In my head the Dropdown folder is the component and the existing Dropdown.mustache is a badly named file :-)
Hope https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/858435 is self explanatory and helpful!

I would prefer us to have a LegacyDropdown class that uses Dropdown and supplies html-before-portlet, html-items and html-after-portal.

@Jdlrobson This part about the LegacyDropdown class, and LegacyDropdown.template in the patch above both makes sense to me

I don't think Dropdown needs data-menus.

However I don't get this part. If we want a Dropdown and PinnableDropdown class that are tied via inheritance or traits, why wouldnt they both have 'data-menus'? I.e. user menu is an example of a Dropdown that would need 'data-menus'.

@Mabualruz, @Jdlrobson, @bwang - I'll go ahead and add the requirements for the empty state of the more menu (details in T317897#8403121) to this ticket. Any concerns?

Change 858435 merged by jenkins-bot:

[mediawiki/skins/Vector@master] [Refactor] Rethink Dropdown component

https://gerrit.wikimedia.org/r/858435

I spoke to @Mabualruz today and said he should have a patch by the end of the week.

Hi @Mabualruz I hope you are feeling better! Since you were out sick I've been working on some of this with Bernard to unblock certain parts of the minimum viable product.

Next week if you could prioritize getting these three patches merged. Please take over the patches and amend them if needed:

  1. https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/865795
  2. https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/865772
  3. https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/866660

Once those are merged, which are somewhat blocking to the rest of the MVP, please wrap up the remaining parts of this work at your leisure.

Note we should plan for not being able to work on this in 2023, so timebox yourself accordingly!

Change 868105 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Fix language button fallback

https://gerrit.wikimedia.org/r/868105

Change 868105 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Fix language button fallback

https://gerrit.wikimedia.org/r/868105

Change 876040 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Components: Model table of contents in title bar.

https://gerrit.wikimedia.org/r/876040

Change 876041 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] [WIP] Component: UserLinks

https://gerrit.wikimedia.org/r/876041

Change 876262 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Move methods to legacy skin

https://gerrit.wikimedia.org/r/876262

Change 879067 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] Test MO // Component: UserLinks Simplify the user links component Introduce MenuListItem and IconLink components.

https://gerrit.wikimedia.org/r/879067

Change 879068 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] Merge remote-tracking branch 'origin/master' into review/jdlrobson/T320927-wip Change-Id: I609a9811340e0b7248cb70b2766e4839b58e3b23

https://gerrit.wikimedia.org/r/879068

Change 879067 abandoned by Mabualruz:

[mediawiki/skins/Vector@master] Test MO // Component: UserLinks Simplify the user links component Introduce MenuListItem and IconLink components.

Reason:

https://gerrit.wikimedia.org/r/879067

Change 876041 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Component: UserLinks

https://gerrit.wikimedia.org/r/876041

Jdlrobson moved this task from Doing to Code Review on the Web-Team FY2022-23 Q3 Sprint 1 board.

Remaining patches in sequencing order are:

Change 876040 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Components: Model table of contents in title bar.

https://gerrit.wikimedia.org/r/876040

Change 879068 abandoned by Mabualruz:

[mediawiki/skins/Vector@master] Merge remote-tracking branch 'origin/master' into review/jdlrobson/T320927-wip Change-Id: I609a9811340e0b7248cb70b2766e4839b58e3b23

Reason:

https://gerrit.wikimedia.org/r/879068

Change 876262 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Dead code elimination: updateDropdownMenuData

https://gerrit.wikimedia.org/r/876262

Change 879903 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] Vector Components Management

https://gerrit.wikimedia.org/r/879903

@Jdlrobson Can we open a cleanup task, and a component's management task and move this one along?

@Mabualruz yes please! Moving to sign off until the new tasks have been created.

Jdlrobson renamed this task from [L] Create Dropdown and Menu Skin component classes to Create Dropdown and Menu Skin component classes.Jan 17 2023, 5:52 PM
Jdlrobson changed the point value for this task from 1 to 5.

Awesome! Thanks Mo!