Page MenuHomePhabricator

StickyHeaders: Investigate Special:MobileOptions setting for expandable sections
Closed, ResolvedPublic3 Estimated Story PointsSpike

Description

Background

Mobile sections are collapsed by default, but users can configure them to expand by default in mobile settings. The A/B test will expand all mobile sections regardless of user preference.

Potential issue: Logged-out users on the Minerva mobile site can toggle this setting. If our A/B test overrides their preference, it may skew results or create a confusing user experience for those who deliberately chose collapsed sections.

Below is a screenshot of the mobile settings found on the Special:MobileOptions provided by MobileFrontend (Minerva mobile + mobile emulation):

Screenshot 2025-11-05 at 3.26.42 PM.png (1×826 px, 173 KB)

The clientpref selectors are defined in MobileFrontend extension (ref) and added to the <html> element.

  • mf-expand-sections-clientpref-0 collapses the sections by default
  • mf-expand-sections-clientpref-1 expands the sections by default

Acceptance Criteria

  • Determine whether the user configurations conflict with the A/B test (details)
  • Document findings and next steps, including an approach to disable the user settings if needed

Communication

Notes

  • Based on these findings, the user settings do not conflict with the prototypes' expanded section behavior.
  • Future implementation options:
    • Option 1: Do nothing
    • Option 2: Disable the setting if enrolled in the experiment
  • Recommendation: Do nothing
    • Rationale:
      • The prototype is temporary code that will be removed after the experiment concludes
      • User settings don't actually affect the expanded section behavior in the prototype
      • Avoids adding code to a separate repository (MobileFrontend) that we'd need to remember to remove later
      • Most casual readers are unlikely to be aware of or interact with these settings
      • Not worth the time investment given the temporary nature of the prototype
  • Discuss options in the Engineering Enclave meeting on November 18th
  • Decision: Disable the user setting for enrolled users
  • Follow-up T410754: StickyHeaders post-A/B test: remove code from MobileFrontend

Event Timeline

lwatson triaged this task as High priority.Nov 6 2025, 8:10 PM
lwatson set the point value for this task to 3.
lwatson moved this task from Incoming/Inbox to Ready on the Reader Growth Team board.
lwatson updated the task description. (Show Details)
lwatson updated the task description. (Show Details)

Change #1204641 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/ReaderExperiments@master] [WIP] StickyHeaders: disable mobile options

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

Change #1204661 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] ReaderExperiments: disable mobile option to expand sections by default

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

Findings: The mobile user configuration settings will not conflict with the Sticky Headers experiment. The experiment uses a special override class (collapsible-headings-expanded) that takes precedence over user preferences, ensuring consistent expanded section behavior across all participants regardless of their mobile settings.

Some things we could look into:

  • We could automatically set the body class mf-expand-sections-clientpref-1 instead of collapsible-headings-expanded and see if that keeps the user pref toggle here in sync with the state of the experiment
  • We may also need to add a small change to MobileFrontend's init.js JS code (or somewhere in that vicinity) to disable any toggling of this preference (perhaps based on the presence of another body class that we add in ReaderExperiments PHP)

Findings: The mobile user configuration settings will not conflict with the Sticky Headers experiment. The experiment uses a special override class (collapsible-headings-expanded) that takes precedence over user preferences, ensuring consistent expanded section behavior across all participants regardless of their mobile settings.

@lwatson based on this, I'm not 100% convinced we should do anything at the moment. There is no way for users to set a "collapse all headings by default" preference (we only allow them to express the opposite preference here).

If we're really concerned about potential confusion, I could see us maybe adding some experiment-detection code to MobileFrontend to set this toggle switch in the disabled, "on" state for users who have been bucketed into the experiment. We might also need to then explain why this UI element is disabled. Finally, we'd need to make sure to go and remove this code once the experiment is complete. I'm not sure it's worth the effort to do this and would be willing to hear arguments either way.

@egardner, I agree we shouldn't merge any code at the moment since the current implementation doesn't address the UI issue for users enrolled in the experiment. I'll -2 the patches for now with a note about the "user enrollment detection" code being dependent on the instrumentation ticket.

Notes

Future Implementation: Check if the user is enrolled in the experiment by detecting the presence of xlab-experiment-{experiment_name} or xlab-experiment-{experiment_name}-{group_name} body class (ref) or using server-side toggling (ref; note that it's unsupported for edge-unique identifier type).

Current Behavior: The code conditionally disables the expand/collapse sections client preference on the Special:MobileOptions page under specific conditions. (patch 1204641 & patch 1204661)

  • Server-side (PHP): Adds the CSS class readerExperiments-mf-expand-sections to the page when all of the following conditions are met:
    1. User is on the Special:MobileOptions page
    2. The returnto parameter points to a main namespace page (NS_MAIN)
    3. The HTTP referer URL contains the stickyHeaders parameter
  • Client-side (JavaScript/jQuery): Detects the CSS class and manipulates the toggle switch to a disabled and checked state (enabled/expanded).

Considerations:

  • Use the clientpref class instead of the override class
    • Client preferences are stored in a cookie
    • Need to determine which pages the client preferences apply to (e.g., main namespace only)
  • Assumption: Casual logged-out readers are unlikely to know about or use mobile settings

Change #1204641 abandoned by LWatson:

[mediawiki/extensions/ReaderExperiments@master] StickyHeaders: set up disabling mobile option

Reason:

This approach is not necessary because xLab provides a body class to detect user enrollment

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

Change #1204661 abandoned by LWatson:

[mediawiki/extensions/MobileFrontend@master] ReaderExperiments: disable mf-expand-sections toggle switch input

Reason:

approach is not necessary. more info in depends-on commit and task

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

lwatson renamed this task from Investigate Minerva mobile logged-out user settings for expandable sections to StickyHeaders: Investigate Minerva mobile logged-out user settings for expandable sections.Nov 17 2025, 6:29 PM
lwatson updated the task description. (Show Details)
lwatson renamed this task from StickyHeaders: Investigate Minerva mobile logged-out user settings for expandable sections to StickyHeaders: Investigate Special:MobileOptions setting for expandable sections.Nov 17 2025, 6:36 PM
lwatson added a project: MobileFrontend.
lwatson updated the task description. (Show Details)
lwatson updated the task description. (Show Details)

Change #1207230 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] ReaderExperiments: disable the expand section setting for /B test

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

Change #1207279 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/ReaderExperiments@master] StickyHeaders: Add JS config to Special:MobileOption

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

Fully QAing this task may require a full local experiment setup (which is not trivial to do), since we are using experiment inclusion as the determining factor of whether this option should be disabled or not.

I QA-ed the actual disabling behavior itself (faking the experiment inclusion test) and things worked as expected. @mfossati let me know if you think it's worth the time to QA this patch by simulating an actual StickyHeaders experiment locally – if not we can move to sign-off.

Change #1207279 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] StickyHeaders: Add JS config to Special:MobileOption

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

Change #1207230 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] ReaderExperiments: disable the expand section setting for A/B test

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

@lwatson @egardner I've locally mocked enrollment into fy2025-26-we3.1.14-session-header-ab-test, treatment group and can confirm that the option is enabled & greyed out.

Screenshot 2025-11-24 at 18.37.21.png (1×846 px, 108 KB)