New parameters to allow to set the class and style of div.mw-references-wrap which is rendered by the <references /> with the parameter 'responsive'
Open, Needs TriagePublic

Description

The old style of <references/> only renders a ol.references so the user can make it wrapped in a custom div to set some style or class to implement other's function, like wikipedia's {{reflist}} to wrap <references/> in the div.reflist to set manual multiple columns and the style of list. The new style of <references/>, which is with the parameter 'responsive', will wrap the ol.references in div.mw-references-wrap, which looks like the div.reflist, to make the function of auto columns. It seems that it will lost custom function which the {{reflist}} have had, like the style of list that it's set by the {{reflist}}.

I suggest that the <references/> add two new parameters, 'class' and 'style' , to allow user to set the div.mw-references-wrap's class and style when the parameter 'responsive' is on. If the parameter 'responsive' is off, the two parameters will not affect the class and style of ol.references.

Cwek created this task.Mar 15 2017, 6:47 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 15 2017, 6:47 AM
Arthur2e5 added a subscriber: Arthur2e5.EditedMar 15 2017, 6:57 AM

of div.mw-references-wrap

You are possibly more interested in adding it directly to the ol.reference element. Or how would you define <references class=aaa style="color:green" responsive=0/>, or just a simple <references class=aaa/> with less than 10 items? I mean, how counterintuitive would these names, or these attributes assuming they get to have better names, be now?

which looks like the div.reflist

The added div is only a device for delivering the column-width CSS rule, and it looks nothing like your div.reflist in that it does not and will not match font-size: 90% and margin-bottom: 0.5em rules in MediaWiki:Common.css. The only ways these two divs are similar are pointless ones:

  • They are both div elements with a default of display:block, and no borders.
  • They are both intended to eventually contain a list of something like references.

It would be unwise to allow adding styles to our "simple device", the conditionally-appearing div element, breaching its cognitive transparency in the process. On a narrow screen where only one column would appear, would or should anyone expect any difference from tweaking the responsive setting or merely adding a reference to make the list length exceed 10? You don't give users beans and tell them to not put beans in their noses.

It seems that it will lost custom function which the {{reflist}} have had, like the style of list that it's set by the {{reflist}}.

The two divs are not mutually exclusive. Throw a list-style-type in the outer one from reflist, and you will be free to go.


In the long run however, it should indeed be recognized that assuming T95543 is right, a way of giving styles and classes without wrapping a div element would be great. (Knowing that references won't accept HTML attributes can be a weird journey.) The only problem with this request is that it's framing the proposal as the solution to a largely non-existent problem.

I am changing the parent task to the aforementioned task.

TheDJ added a subscriber: TheDJ.Mar 15 2017, 10:12 AM

I'd say there is no need for a style attribute, but yes classes would be interesting.

<references class="mw-columns-narrow mw-upper-roman" /> would solve almost every remaining use case of template reflist.

@TheDJ You and I may want to hijack this issue to make it target the entire ol.references though. Targeting the conditionally-appearing div is problematic...

He7d3r added a subscriber: He7d3r.Mar 15 2017, 6:25 PM
Cwek added a comment.Mar 17 2017, 1:01 AM

I'd say there is no need for a style attribute, but yes classes would be interesting.

<references class="mw-columns-narrow mw-upper-roman" /> would solve almost every remaining use case of template reflist.

Yes, It looks like that. And Maybe it's easy to implement because it just adds more class, doesn't modify the original div's class.

Arthur2e5 added a comment.EditedMar 17 2017, 1:39 AM

mw-columns-narrow

Oops, this is actually when things get interesting for ol. It has display: block by default, so columns should supposedly work. However, issues with leaving enough gaps for the numbers would kick one back into making div s.

So getting columns done in references may mean a constant layer of div wrapper around ol.references. (Or a :has() selector for some other div?) With that change, the responsive part could be adding .mw-references-wrap to the constant wrapper instead. (Oops, this one sounds more like a nonspecific class name for a constant wrapper.) The class added by responsive can in turn help decide whether rules for mw-columns-narrow gets used (e.g. div.mw-references-wrap.mw-columns-narrow { column-width: 15em; }), as one generally don't want to columnize short lists.

it just adds more class

Since reflist's customization is never part of MediaWiki, a request for Cite would naturally be making something new, separate from what was on some wikis. Rewriting when rethinking is indeed a good thing.