Page MenuHomePhabricator

Spike: IP Info accordion: Shows both expand and collapse icons on mobile web [16 H]
Closed, ResolvedPublicBUG REPORT

Description

Screen Shot 2021-08-10 at 10.30.43 PM.png (1×1 px, 503 KB)

(screenshot from T271673#7271224)

  • General investigate of what is happening here... and from there, should we remove infobox from mobile or should we fix it?
Outcomes
  1. tl;dr: T288718#7562543
  2. T288718#7562836

Event Timeline

Niharika changed the subtype of this task from "Task" to "Bug Report".Sep 24 2021, 6:39 AM
ARamirez_WMF renamed this task from IP Info accordion: Shows both expand and collapse icons on mobile web to Spike: IP Info accordion: Shows both expand and collapse icons on mobile web.Nov 10 2021, 5:42 PM
ARamirez_WMF renamed this task from Spike: IP Info accordion: Shows both expand and collapse icons on mobile web to Spike: IP Info accordion: Shows both expand and collapse icons on mobile web [16 H].Nov 10 2021, 5:47 PM

In a way, this was fixed by @TThoabala in T293011: Infobox (accordion) is inserted before partial block notice [M] 🎉 In that task we started inserting the infobox via the SpecialContributionsBeforeMainOutput hook. The mobile site's version of the contributions page doesn't fire that hook and so the broken infobox no longer appears on the mobile site:

1.png (1×2 px, 246 KB)

Change 745835 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/IPInfo@master] DNM: infobox: Make infobox work on the mobile site

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

Change 745835 abandoned by Phuedx:

[mediawiki/extensions/IPInfo@master] DNM: infobox: Make infobox work on the mobile site

Reason:

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

Change 745835 restored by Phuedx:

[mediawiki/extensions/IPInfo@master] DNM: infobox: Make infobox work on the mobile site

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

Change 745835 abandoned by Phuedx:

[mediawiki/extensions/IPInfo@master] DNM: infobox: Make infobox work on the mobile site

Reason:

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

Following on from my comment above, I decided to revert @TThoabala's patch for T293011: Infobox (accordion) is inserted before partial block notice [M] and document the steps we'd need to take to get the infobox working-ish on the mobile site with as few modifications as possible. What follows are a couple of screenshots of my local development wiki and notes on how I got it to that state:

CollapsedExpanded
1.png (1×800 px, 118 KB)
2.png (1×800 px, 160 KB)
  1. Firstly, the ext.ipInfo and ext.ipInfo.styles ResourceLoader modules need to be loadable on the mobile site. Concretely, we need to set the modules' targets property to [ "desktop", "mobile" ]
  2. The CollapsibleFieldsetLayout isn't made collapsible by OOIU but by the mediawiki.htmlform module – the mediawiki/resources/src/mediawiki.htmlform/htmlform.js file specifically – so:
    • The ext.ipInfo module should be updated to explicitly depend on the mediawiki.htmlform module
    • The mediawiki.htmlform.styles module styles should be loaded
    • We shouldn't declare the CollapsibleFieldsetLayout component as infusable in IPInfo/src/HookHandler/InfoBoxHandler.php
  3. Currently, we extract the revision ID of the last edit that the editor made from the DOM. The mobile site's DOM structure for the page is different and so we need to add support, i.e.
IPInfo/modules/ext.ipInfo/infoBox/init.js
var revId = $( '.mw-contributions-list [data-mw-revid]' ).first().attr( 'data-mw-revid' );

// Support Special:Contributions on the mobile site
if ( !revId ) {
  revId = $( '.page-list .page-summary a.title' )
    .first()
    .attr( 'href' )
    .split( '/' )
    .pop();
}

1 & 2 are easy lifts. 3, on the other hand presents us with an opportunity to tidy up the infobox init script. We could and should consider:

  1. Extracting both the collapsed/expanded persistence and the terms of use treatment into a shared component or components
  2. Creating skin-specific init scripts for the Vector (desktop) and MinervaNeue (mobile) skins, leveraging ResourceLoader's skinScripts mechanism to deliver the appropriate init script (see https://codesearch.wmcloud.org/extensions/?q=skinScripts for several examples)
Tchanders subscribed.

To summarise: we can get this working on mobile. With a few small fixes it would look like the screenshots in T288718#7562836.

@Prtksxna If you could confirm whether the infobox should be available on mobile, and if so, what it should look like, we can create some tasks and get working on it.

@Prtksxna Hey Prateek, is this ticket ready to be moved out of Design Review?