phabricator.wikimedia.org

⚓ T111565 Enable collapsible templates (including infoboxes) on mobile

  • ️Fri Sep 04 2015

Enable collapsible templates (including infoboxes) on mobile

Background

On desktop, if an article has multiple infoboxes, we collapse each subsequent infobox after the first:

Screen Shot 2016-10-12 at 1.47.36 PM.png (569×1 px, 147 KB)

We didn't do this on mobile and it takes up a lot of space
https://en.m.wikipedia.org/wiki/California
Recently the English Wikipedia added a gadget that undid the mobile behaviour making the behaviour inconsistent across all Wikipedias.

User story

AS a reader I want a consistent experience across wikis for collapsible content.

Developer notes

NOTE: The code that provides collapsible content currently resides in

mediawiki.page.ready

which also provides functionality for sortable tables which is captured in the sister task T233340

Problem

On the desktop, Same-sex marriage in Kentucky (and other US states) looks fine. Template:Same-sex unions runs down the right-hand side of the page, taking only about one-third of the width available for text (on my laptop at a size comfortable for my old eyes), and only its first section, Marriage, is expanded; the other three, Civil unions and registered partnerships, Unregistered cohabitation, and See also, are initially collapsed, with a "[Show]" button.

On my smartphone,* though, the template comes up fully expanded at almost the very top of the page, with only the title and the lead graphic above it. I have to scroll five full screens to reach the first line of text. Need I say how awkward this is? especially with the risk of tapping a link as I tap-scroll down.


* Samsung Verizon Android Galaxy S-3, model SCH-I535, OS v4.4.2

https://gerrit.wikimedia.org/r/431662 POC: Enable collapsible elements on Minerva is a proof of concept.

Design

expandable-template-mobile.png (667×375 px, 114 KB)

  • bg color remains the same #f8f9fa
  • icon is a small version of mw-ui-icon-mf-arrow (same as toggle) but in blue color. (see related T198770)
  • "Show more" button is 14px, blue, normal weight. Note, that the text of the button comes from editors so don't worry about the copy text here. We cannot change it.

Acceptance criteria

  • Update SkinMinerva::getDefaultModules to include jquery.makeCollapsible when requested - see https://gerrit.wikimedia.org/r/431662 POC: Enable collapsible elements on Minerva is a proof of concept.)
  • Add new styles for Minerva, per design, ensuring they do not cause FOUC when loaded and collapsed elements begin collapsed.
  • This is used in various ways by editors (see T199924: Hidden images in vector arwiki display in Minerva) some community outreach/testing as part of deployment would be advisable.
  • Enable the config option inside the PageReady hook

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

This task was created by Version 1.0.0 of the Web team task template using phabulous

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Comment Actions

I fixed this in Bawl (for the whole page) and the same code is part of EditNoticesOnMobile (T312299) for edit notices. Just search the source for "T111565". It's really nothing spectacular.

It works and I haven't heard any complaints yet.

Comment Actions

Removing task assignee due to inactivity as this open task has been assigned for more than two years. See the email sent to the task assignee on August 22nd, 2022.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome!
If this task has been resolved in the meantime, or should not be worked on ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!

Comment Actions

Change 859605 abandoned by Bartosz Dziewoński:

[mediawiki/skins/MinervaNeue@master] Allow collapsible content in Minerva

Reason:

I will submit a specific patch for T323639 (collapsible mobile talk page banners), since everyone else wants a more complex solution for T111565 (collapsible content on mobile in general).

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

Comment Actions

I can't find the relevant comment, but this is deemed to be an insufficient UX on touchscreens by the WMF devs.

You're probably looking for the patch commentary in https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/859605/ . It's the only place I've seen an objection along this line in recent times.

TBH I'm in the party of "the perfect is currently being the enemy of the good" regarding allowing things to be collapsed. I get the concern regarding button size, but OTOH I don't see it as major enough to block the enhancement that collapsing things brings.

Comment Actions

I can't find the relevant comment, but this is deemed to be an insufficient UX on touchscreens by the WMF devs.

You're probably looking for the patch commentary in https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/859605/ . It's the only place I've seen an objection along this line in recent times.

TBH I'm in the party of "the perfect is currently being the enemy of the good" regarding allowing things to be collapsed. I get the concern regarding button size, but OTOH I don't see it as major enough to block the enhancement that collapsing things brings.

Thanks, that's what I was referring to. To quote from the comments: "But the issue is the fat finger problem – the [show] links are not that big, so pressing them may be challenging."

I don't use touch devices extensively to browse the web (I need a physical keyboard) so it's harder for me to judge, but if someone's fingers are so fat they can't click an "Expand" link, they can't click any link really, right? So they have bigger problems.

Outside of that, some CSS could help to make the links wider, especially if the words "Show"/"Expand"/"Collapse"/"Hide" are very short in any particular language. Say (just paste in your browser console to test),

mw.util.addCSS('.skin-minerva button.mw-collapsible-toggle{min-width:8em}')

Comment Actions

As there are people opposed to making this change in MediaWiki core, I would suggest doing it in your wiki's MediaWiki:Common.js or a gadget, as long as your community finds that agreeable.

Comment Actions

It's worth noting that mobile MediaWiki already supports collapsible class, which is almost the same as mw-collapsible in appearance.

Comment Actions

It's worth noting that mobile MediaWiki already supports collapsible class, which is almost the same as mw-collapsible in appearance.

That doesn't work for me. I don't think it's a MediaWiki feature, but it's a fairly common on-wiki customization (older than mw-collapsible).

Comment Actions

It's worth noting that mobile MediaWiki already supports collapsible class, which is almost the same as mw-collapsible in appearance.

That doesn't work for me. I don't think it's a MediaWiki feature, but it's a fairly common on-wiki customization (older than mw-collapsible).

Ah, appears that you're right. I must have missed the on-wiki code that supports it.

Comment Actions

It's worth noting that mobile MediaWiki already supports collapsible class, which is almost the same as mw-collapsible in appearance.

That doesn't work for me. I don't think it's a MediaWiki feature, but it's a fairly common on-wiki customization (older than mw-collapsible).

Ah, appears that you're right. I must have missed the on-wiki code that supports it.

On English Wikipedia it's part of https://en.wikipedia.org/wiki/MediaWiki:Common.js but Common.js doesn't load on mobile.

Curiously, plwiki (which appears to be your home wiki?) has https://pl.wikipedia.org/wiki/MediaWiki:Mobile.js to enable collapsible elements on mobile. While shorter, it's less efficient than the gadget proposed on enwiki and won't work when the page content is refreshed e.g. after editing a page.

[edit]
Oh, you created that page! I'd actually suggest you install https://en.wikipedia.org/wiki/Wikipedia:MakeMobileCollapsible#Installation_on_other_projects as it's more efficient than loading the module unconditionally on every page load.

Comment Actions

It's worth noting that mobile MediaWiki already supports collapsible class, which is almost the same as mw-collapsible in appearance.

That doesn't work for me. I don't think it's a MediaWiki feature, but it's a fairly common on-wiki customization (older than mw-collapsible).

Ah, appears that you're right. I must have missed the on-wiki code that supports it.

On English Wikipedia it's part of https://en.wikipedia.org/wiki/MediaWiki:Common.js but Common.js doesn't load on mobile.

Curiously, plwiki (which appears to be your home wiki?) has https://pl.wikipedia.org/wiki/MediaWiki:Mobile.js to enable collapsible elements on mobile. While shorter, it's less efficient than the gadget proposed on enwiki and won't work when the page content is refreshed e.g. after editing a page.

[edit]
Oh, you created that page! I'd actually suggest you install https://en.wikipedia.org/wiki/Wikipedia:MakeMobileCollapsible#Installation_on_other_projects as it's more efficient than loading the module unconditionally on every page load.

The table.collapsible is supported in the same gadget as NavFrame on pl.wiki :). I've made the code a bit more modern and also added a11y (WCAG) recently.

It's a drop-in replacement for old NavFrame. So you can copy it to en.wiki (or any other wiki). A translation of labels is required:

var collapseCaption = "ukryj";
var expandCaption = "pokaż";

https://pl.wikipedia.org/wiki/MediaWiki:Gadget-NavFrame.js

The definition:

NavFrame [ResourceLoader | hidden | targets=desktop,mobile | default] | NavFrame.js | NavFrame.css

Comment Actions

(Given how few uses of NavFrame pl.wp has [around 600 ], I'd be happy to make it so you don't need that default loading anymore ;).)

Comment Actions

@Izno Actually NavFrame is used on all year pages for collapsing navigation in a nice and more accessible way (both for sighted users and for users using screen readers and for mobile UX). But if you think you can do it with the default then we can discuss that. We can discuss that on WP:BAR:TE or on the template's page. In general default collapsing is visibly slower to load though.

Comment Actions

As there are people opposed to making this change in MediaWiki core, I would suggest doing it in your wiki's MediaWiki:Common.js or a gadget, as long as your community finds that agreeable.

What exactly is the opposition here? Who is opposed to making this change (I can't see anything about this in the ticket).

My understanding of this ticket is nobody is prioritizing this work, the work is challenging and that's the only problem here.
(see mocks

collapse-table.png (1×750 px, 179 KB)

)

Why are we encouraging the creation of a gadget which would just be technical debt for that project and instead not encouraging someone to attempt to satisfy the good ideas in this ticket?

Comment Actions

What exactly is the opposition here? Who is opposed to making this change (I can't see anything about this in the ticket).

T111565#9135498 points to the relevant gerrit patch review of which you were a part. I would be as happy as anyone to have it loaded 'natively', but until someone prioritizes doing so, a gadget it is. (Speaking of which, we're planning to roll that out to all mobile users Soon after the briefest of brief trials with registered users. Better hang on to your hats.)

Comment Actions

What exactly is the opposition here? Who is opposed to making this change (I can't see anything about this in the ticket).

T111565#9135498 points to the relevant gerrit patch review of which you were a part. I would be as happy as anyone to have it loaded 'natively', but until someone prioritizes doing so, a gadget it is. (Speaking of which, we're planning to roll that out to all mobile users Soon after the briefest of brief trials with registered users. Better hang on to your hats.)

Right but the patch didn't pose opposition - it just recognized that the fat finger concern is a problem and is hard to solve.

(Speaking of which, we're planning to roll that out to all mobile users Soon after the briefest of brief trials with registered users. Better hang on to your hats.)

It doesn't look like the gadget addresses the fat finger concern so I'm not sure why we intentionally want to roll out a bad experience to end users? If you want to go down the path, why not just introduce a feature flag to the relevant line of code on https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/859605/2/includes/Hooks.php configurable and make this a config change ? Why ship a gadget that could break further down the line when someone fixes this properly?

Comment Actions

As there are people opposed to making this change in MediaWiki core, I would suggest doing it in your wiki's MediaWiki:Common.js or a gadget, as long as your community finds that agreeable.

What exactly is the opposition here? Who is opposed to making this change (I can't see anything about this in the ticket).

My understanding of this ticket is nobody is prioritizing this work, the work is challenging and that's the only problem here.

In gadget/userscript form I made ColMask which is yet another take. Code is a bit messy though and it's JS on top of jquery.makeCollapsible. It does address the fat finger problem though, the whole collapsed object can be clicked to expand it and it uses buttons.

Comment Actions

What exactly is the opposition here? Who is opposed to making this change (I can't see anything about this in the ticket).

T111565#9135498 points to the relevant gerrit patch review of which you were a part. I would be as happy as anyone to have it loaded 'natively', but until someone prioritizes doing so, a gadget it is. (Speaking of which, we're planning to roll that out to all mobile users Soon after the briefest of brief trials with registered users. Better hang on to your hats.)

Right but the patch didn't pose opposition - it just recognized that the fat finger concern is a problem and is hard to solve.

(Speaking of which, we're planning to roll that out to all mobile users Soon after the briefest of brief trials with registered users. Better hang on to your hats.)

It doesn't look like the gadget addresses the fat finger concern so I'm not sure why we intentionally want to roll out a bad experience to end users?

It partially does. It enforces a link width of 6em, so links with short labels are never super tiny.

If you want to go down the path, why not just introduce a feature flag to the relevant line of code on https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/859605/2/includes/Hooks.php configurable and make this a config change ? Why ship a gadget that could break further down the line when someone fixes this properly?

Because

Reason 1: No environment

Because I don't have the environment set up nor the knowledge to create/file a patch you can process. It's been suggested to me before by matmarex as they cited a problem is often to find reviewers, so if someone else filed a patch for something they could review it. I'm sure I could figure all that out, but I generally focus on whatever interests me most and which I suspect will bring me the least frustration. I'm not paid, so frustration is a hard pass.

I guess if someone would be willing to pay $100 and link a guide they know is up-to-date and won't result in dependency hell (or answer questions for an outdated guide personally) I'd do it. But I wouldn't expect anyone to pay that, and I dislike frustration, so that's why.

Reason 2: Rusty

Last time I wrote more than one line of PHP was probably more than 10 years ago. Made my own weblog software, it had one user besides myself! :-D But I learn quickly so I could probably figure this out. Any actual programming isn't as frustrating for me.

Reason 3: Unlikely to break

Nothing is likely to break, the gadget just loads jquery.makeCollapsible.

Comment Actions

I support @AlexisJazz in this. This is not their problem, not the communities problem. This is exactly what gadgets are for. A lot of the functionality that is now in core started out as a gadget and was used like that until Core developers got around to adopting the code. As it seems that there are few people willing to adopt code like this, this seems like the proper way forward.

Comment Actions

The ColMask plugin looks pretty cool to me. Thanks for sharing that!

Reason 1 and 2 are fair. I know https://m.mediawiki.org/wiki/Gerrit_patch_uploader exists but I wish there were less barriers in place for improving code.

Regarding 3, CSS is not stable per our policy so my concern is that if we do fix this in the codebase and that CSS conflicts with the gadget there is a risk of incompatible styles being shipped if this is later worked on.

@TheDJ My concern here is this issue impacts other projects and a lot of emphasis seems to be given to English Wikipedia in prioritization (if it works there this bug will likely never get worked on and the gadget will be copied and pasted everywhere. If this is the best we can do right now, I think we should just load the code in Minerva (with a comment pointing to this ticket), remove the gadget and any inherited design issues would then be shared across all projects. This ticket can then live in the backlog as a "bug" for whenever it becomes a priority.

Comment Actions

Change #1037601 abandoned by Jdlrobson:

[mediawiki/skins/MinervaNeue@master] Enable collapsing code on mobile

Reason:

Used https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/859605?usp=search which predates mine.

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

Comment Actions

Given we now have mw.collapsible on Minerva, I think it makes sense to close this task resolved and open a new one for any refinements a designer wants to work on, since that apparently remains a concern.

Content licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) 4.0 unless otherwise noted; code licensed under GNU General Public License (GPL) 2.0 or later and other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL · Credits