Page MenuHomePhabricator

Consider adding suggestion widget to OOUI
Open, Needs TriagePublic

Description

We now have two extensions (MachineVision and GrowthExperiments ) using a Suggestion Widget (see T237585 and T238610 for screenshots). It would be nice to consider upstreaming this so that both projects (and others in the future) can benefit from shared maintenance and development. At the moment we in Growth have copy-pasted (🙀) the code from MachineVision.

Event Timeline

kostajh created this task.Jan 10 2020, 10:25 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 10 2020, 10:25 AM
AnneT updated the task description. (Show Details)
AnneT updated the task description. (Show Details)

That looks basically the same as our CheckboxMultiselectWidget.

There are some issues with the existing code in MachineVision that I ran into when I copied it to GrowthExperiments:

  • It depends on mediawiki.template.mustache+dom, which is in the WikibaseMediaInfo extension (MachineVision already depends on WBMI, but it doesn't make sense for GrowthExperiments to depend on WBMI)
  • The mustache+dom templating engine avoids destructively rerendering embedded OOUI widgets, which is good, but it does destructively rerender nodes created by the template. This is a problem, because it breaks CSS transitions for state changes.
  • Because CSS transitions don't work, the widget uses CSS animations instead. But that causes a bug where the widgets animate (the text moves from left to right) when they're being unhidden or added to the DOM.
  • There is no clean group widget for these, so I had to make one by picking the relevant pieces from ImageWithSuggestionsWidget (which contains a lot of other things as well). Without that, the SuggestionWidgets don't behave correctly, because they rely on a CSS class set on the parent element to hide the outline.
  • These widgets don't extend SelectWidget and OptionWidget, which means you have to reinvent some wheels around selection management and getting the selected values from the group widget for example

Overall I agree with @matmarex that this is functionally a CheckboxMultiselectWidget, just with different styling.

I'd recommend upstreaming this into MW as a MediaWiki widget first, before moving all the way to OOUI.