Page MenuHomePhabricator

VisualEditor removes empty paramaters when adding infobox
Closed, ResolvedPublic

Description

This seems like some new problem with VE. Tested in Firefox 86 (current).

Steps:

  1. Polish Wikipedia, any article.
  2. Type "{{" (template).
  3. "Snookerzysta infobox".
  4. Fill first field/parameter.
  5. Add and ignore warnings.
  6. View changes (don't save please ;-))

Result

Only a filled parameter is present in code. So only one is visible in code preview. Both required parameters and suggested ones are removed by VE (not by user).

Note that the same thing happens on enwiki. Was just easier for me to find a good example on plwiki. On enwiki you can test e.g. with a "Infobox station" template and fill just an "address" field (you will notice that "name" is not present in code).

Expected

All parameters that are not removed in VE must be present in code. This includes both required and suggested parameters.
Required parameters must remain unremovable in VE (as they are now).

https://pl.wikipedia.org/wiki/Wikipedia:Kawiarenka/Kwestie_techniczne#Wstawianie_szablonów_w_edytorze_wizualnym

Event Timeline

matmarex added a subscriber: matmarex.

Removing suggested parameters was an intentional change from T101075. However, this should probably not be done for parameters that are required.

As a reference: Possibility to remove required params was explicitly blocked in T62358.

Change 671269 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] ve.dm.MWTemplateModel: Never remove empty required parameters

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

Change 671269 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ve.dm.MWTemplateModel: Never remove empty required parameters

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

I filed a new task about better support for parameters that are intentionally empty: T280078. That would allow us to restore the previous behavior, where suggested parameters are always added to the wikitext when inserting the infobox (even when they're not required and they're not filled in).