Page MenuHomePhabricator

Increase or remove limit to number of "manual" citation templates are shown in the visual editor
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • There are 5 citation templates to choose from, the last one being "Pressemelding" (press release)
  • The templates that are shown are defined in MediaWiki:Cite-tool-definition.json
  • Since 2014, our list of templates has had 9 source templates in it (but I removed two of them while researching this task, so there are now 7), however only the 5 first templates in the list have been available in the menu in visual editor for all that time.

Why it happens:

What should have happened instead?:

  • The limit should either be removed entirely, or increased to an amount above the number of templates wikis can reasonably be expected to include.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Change #1161472 had a related patch set uploaded (by Jon Harald Søby; author: Jon Harald Søby):

[mediawiki/extensions/Cite@master] Increase limit of citation templates in VE's cite menu

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

I did some research, so you don't have to!

I visited every single MediaWiki:Cite-tool-definition.json page in Wikimedia production, and except for my home wiki, nowiki, they all have 5 or fewer templates listed. So that's the only Wikimedia wiki that would be affected by the increased limit in the patch I just added (and it would be affected by having more templates available, as has been the intention for 10+ years).

For what it's worth, we hit this limit today on Deltarune Wiki with our 7 citation templates. Could this perhaps be made configurable? Can make another patch myself if so.

Any idea why the limit was introduced in the first place?

As requested in the patch, here are some screenshots of the connected patch in some different scenarios.

To create these screenshots, I added 140 citation templates into MediaWiki:Cite-tool-definition.json, and then changed the limits in src/ResourceLoader/CitationToolDefinition.php.

I think this illustrates pretty well that just removing the limit entirely would work fine, and that we shouldn't be setting any arbitrary hard-coded limit in the extension at all. Having 100+ templates looks overly complicated, sure, but if a wiki wants to do that, why should we stop them?

Without Citoid

Limit: 8

Screenshot_20250917_091300.png (976×587 px, 35 KB)

Limit: 20 (there's scrolling)

Screenshot_20250917_091348.png (986×1,002 px, 51 KB)

No limit at all (more scrolling)

Screenshot_20250917_091436.png (982×1,007 px, 50 KB)

With Citoid

Limit: 8

Screenshot_20250917_092532.png (986×529 px, 33 KB)

Limit: 20

Screenshot_20250917_092554.png (1,003×818 px, 48 KB)

No limit at all (scrolling)

Screenshot_20250917_092628.png (981×1,084 px, 59 KB)

why should we stop them?

As discussed in https://gerrit.wikimedia.org/r/1161472 there are reasons to limit the number. To repeat: What are users supposed to do with a selection of 20 different citation templates? How should they know which one to use? There is no way for them to find out, no descriptions, no tooltips, no help, no search feature. To be fair there is Ctrl+Shift+P, but it's not designed for this.

What's designed for this is the template dialog. I agree it's a bit awkward to reach (you have to add a "basic" citation and then insert a template into the citation). That could be improved.

Users with a selection of 20 different templates are supposed to look at their icons and titles and select the template they need. Why wouldn't they be able to do that? If the icons and titles are unclear, that's the fault of the wiki admin who configured the templates.

On my wikis, the template dialog is not "a bit awkward", it's completely useless for inserting citations to any new wiki editor who doesn't know about the existence of citation templates on the wiki. They would use the Cite menu, insert a Basic citation, then write whatever text they wanted to use as a citation into the citation itself (because they don't know that there is a template they can use, or even understand the concept of templates). Any editor who already knows about the existence of citation templates would, most often, not be using VisualEditor at all. Therefore the discovery of citation templates is greatly improved by the citation tool, if only it allowed for more than 5.

If you want to restrict the amount of citation templates specifically for Wikimedia wikis, why not introduce a configuration option letting other wikis increase the limit to their liking?

[…] introduce a configuration option letting other wikis increase the limit to their liking?

That hard-coded 5 in the code should totally be a configuration option, I agree. That would be a purely technical change that could be approved by the dev team, as long as the default for Wikimedia wikis doesn't change.

However, this ticket was originally about Wikimedia wikis. It's a bit confusing to discuss both in the same thread.

I see. Should I open a separate ticket and send a new patch?

Change #1161472 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Increase limit of citation templates in VE's cite menu

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