Page MenuHomePhabricator

On slow connections, already opened sections collapse after the user has opened them
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Background

If a user has a slow connection and views a page and begins opening sections, when the page finishes loading all the sections collapse. This is not a good experience for users.

collapsed.gif (476×584 px, 1 MB)

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

  • Load enwiki:Earth with device emulation set to a mobile device
  • From the Performance tab, apply 4x CPU slowdown and Slow 4G network throttling (for example)
  • Reload the page, click section headers to expand some sections before JS modules from the resourceloader are fully loaded

What happens?:

The sections you expanded before JS is loaded collapse, because of the hidden="until-found" attribute is set.

What should have happened instead?:

The sections you expanded before JS is loaded stay expanded, without the hidden attribute.

There should be tests for this behaviour.

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

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

QA test steps

Fix should be live on beta, but not yet on enwiki.

Test page "Fox" on beta:

  • load https://en.wikipedia.beta.wmcloud.org/wiki/Fox in Chrome with mobile simulation on
  • set dev tools network throttle to "3G" and CPU throttle to "4x slowdown"
  • reload
  • while loading, scroll down and unfold a section or two
    • note they will not be re-collapsible until the full JS loads
  • wait until the full JS loads
  • check the sections you collapsed
    • they should remain open
    • they should now respond as expected to further taps to re-close/re-open

Event Timeline

Change #1196802 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/MobileFrontend@master] Toggler: Keep expanded sections when initialising

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

Change #1196802 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/MobileFrontend@master] Toggler: Keep expanded sections when initialising

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

Described different problems with different root causes.

Change #1196802 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/MobileFrontend@master] Toggler: Keep expanded sections when initialising

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

HSwan-WMF moved this task from Incoming/Inbox to Needs Refinement on the Reader Growth Team board.

Hi @Func, thanks for posting.

We are currently working on an experiment around defaulting mobile sections to expanded instead of defaulting them to collapsed. We're going to launch an A/B test around this for a subset of users in a few weeks. Based on the data we get, we may decide to move away from auto-collapsing mobile sections in general.

We can revisit this bug once we have some initial findings here.

Still vaid- waiting for sticky headers experiment

Jdlrobson-WMF renamed this task from MobileFrontend: Sections expanded via mfTempOpenSection collapse when JS is loaded to On slow connections, already opened sections collapse after the user has opened them.Dec 10 2025, 5:56 PM
Jdlrobson-WMF raised the priority of this task from Low to Medium.
Jdlrobson-WMF updated the task description. (Show Details)
Jdlrobson-WMF updated the task description. (Show Details)
Jdlrobson-WMF subscribed.

Bumping priority as I think this is very user visible and bad.

Patch is _very close_ but there's one thing that still bugs me -- the sections that I open before loading is complete end up with the disclosure arrow pointing down, as in closed sections, not up as in later-opened sections:

image.png (808×732 px, 583 KB)

an early-opened section:

<div class="mw-heading mw-heading2 section-heading open-block collapsible-heading" tabindex="0" role="button" aria-controls="content-collapsible-block-1" aria-expanded="true">
  <span class="mf-icon mf-icon-expand mf-icon--small indicator "> </span>
  <h2 id="History">History</h2>
  <span class="mw-editsection">
    <a role="button" href="/w/index.php?title=Paris&amp;action=edit&amp;section=2" title="Edit section: History" class="cdx-button cdx-button--size-large cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--icon-only cdx-button--weight-quiet ">
      <span class="minerva-icon minerva-icon--edit"></span>
      <span>edit</span>
    </a>
  </span>
</div>

A correctly opened section:

<div class="mw-heading mw-heading2 section-heading collapsible-heading open-block" tabindex="0" role="button" aria-controls="content-collapsible-block-0" aria-expanded="true">
<span class="mf-icon mf-icon-expand mf-icon--small indicator mf-icon-rotate-flip"> </span>
<h2 id="Etymology">Etymology</h2>
<span class="mw-editsection">
  <a role="button" href="/w/index.php?title=Paris&amp;action=edit&amp;section=1" title="Edit section: Etymology" class="cdx-button cdx-button--size-large cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--icon-only cdx-button--weight-quiet ">
    <span class="minerva-icon minerva-icon--edit"></span>
    <span>edit</span>
  </a>
  </span>
</div>

The difference is the mf-icon-rotate-flip class on the icon.

... I was able to add that fairly straightforwardly to the temp function and preserve it after initialization -- need to double-check no explosions in parsoid vs non-parsoid. ;)

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/1196802/8

bvibber set the point value for this task to 3.Dec 17 2025, 6:13 PM

Ok looks like the expand-during-load stuff just doesn't work on Parsoid output anyway, so no regression there. Only relevant to legacy parser.

Change #1196802 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Toggler: Keep expanded sections when initialising

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

Etonkovidova subscribed.

Checked in betalabs - works as expected; ready for Signoff.

Confirmed from my end this is merged and ready for signoff. :)

Confirmed that the fix is live on Beta. This is done.