Page MenuHomePhabricator

When printing jquery.makeCollapsible collapsed elements should be expanded
Open, Needs TriagePublic

Description

When printing, collapsible elements should be expanded in print output.

It is because the "user" of the paper cannot expand them by himself. They should be already expanded.

It can be done with @media CSS styles.

Event Timeline

Can you please provide an example what a "collapsible element" is, or some link to a page where this problem can be reproduced?
Also, which project is this about? Is this about MediaWiki core, or some extension?

Please see https://mediawiki.org/wiki/How_to_report_a_bug for future tasks. Thanks!

Legoktm subscribed.

Probably referring to jquery.collapsible.

I refer to collapsible elements.

Print "[Collapse]" button in the first example and then do Print or Print Preview.

Elements collapsed on the scree should not be collapsed in print;

TheDJ renamed this task from Print collapsible elements expanded to When printing jquery.makeCollapsible collapsed elements should be expanded.Jun 15 2017, 12:04 PM

I have added the following snippet to https://en.wikipedia.org/wiki/MediaWiki:Print.css

.mw-parser-output .mw-collapsed .mw-collapsible-content {
	display: block !important;
}

This could be added to our stylesheets.

Does this CSS snippet actually work? The hidden elements on https://en.wikipedia.org/wiki/Help:Collapsing are not expanded in print preview.

Also I have added this snippet to my private wiki (1.27.3), then created a page with the following:

<div class="toccolours mw-collapsible mw-collapsed">
This text is not collapsible; but the next is collapsible and hidden by default:
<div class="mw-collapsible-content">Lorem ipsum dolor sit amet...</div>
</div>

and the hidden text remained hidden in the print preview.

@johnnybaloney Apologies, you are absolutely correct. The full snippet should have been:

.mw-parser-output .mw-collapsed .mw-collapsible-content {
	display: block !important;
}
.mw-parser-output table.mw-collapsed > * > tr {
	display: table-row !important;
}
.mw-parser-output ol.mw-collapsed > li,
.mw-parser-output ul.mw-collapsed > li {
	display: list-item !important;
}

I've update English Wikipedia for this now.

Great, thanks! In my 1.27.3 instance I had to drop .mw-parser-output as no such class seem to be in use. I also added hiding of span.toctoggle for the TOC [hide] element.

Change 370945 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/core@master] mw-collapsible: Add print styles to uncollapse content

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

The toggle button is useless on paper and should hidden on the print version.

For the collapsible content it may be useful to allow hiding on print version by selecting the wanted state of the toggle buttons and then start printing.

It may be useful to add two additional CSS classes for the authors for overriding the normal behavior for the print version:

.mw-collapsible-hide-on-print

and

.mw-collapsible-show-on-print

where it may be useful for the content.

@Fomafix in general, that's just wasteful. We have classes for people to manipulate how coordinates display. About 50 people use that, of which only 10 or so are still active. It's totally useless.

Then let the readers decide if something is on the printable version or not and keep the current behavior.

Change 370945 abandoned by TheDJ:
mw-collapsible: Add print styles to uncollapse content

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

It may be useful to add two additional CSS classes for the authors for overriding the normal behavior for the print version:

.mw-collapsible-hide-on-print

and

.mw-collapsible-show-on-print

where it may be useful for the content.

That behavior can be easily achieved without additional classes. the class="mw-collapsible" is the same as class="mw-collapsible-show-on-print, while class="mw-collapsible noprint" is the same as class="mw-collapsible-hide-on-print", so editors can easily override the suggested behavior easily. The only behavior that wouldn't be supported is for readers deciding the state of each of the collapsible blocks, and I think that's better than the alternative of printing an article and missing part of the content that editors decided it was important, but not important enough to put it with a noprint class.