Page MenuHomePhabricator

Simplify Toggler code so it doesn't use session storage
Open, MediumPublic

Description

Background

The Toggler.js code (src/mobile.startup/Toggler.js) uses session storage to track open sections and restore the page on reload/back button. Following the changes to section heading markup this no longer works. In T373798 we discovered this is no longer being utilized and can be removed given the back/forward cache is supported by all browsers now.

User story

As a reader I don't want Wikipedia to store data it doesn't use.

Requirements

  • The following functions have been removed from Toggler:
  • getExpandedSections
  • expandStoredSections
  • Any methods used exclusively by these methods.

BDD

  • For QA engineer to fill out

Test Steps

  • For QA engineer to fill out

Design

  • Add mockups and design requirements

Acceptance criteria

  • Add acceptance criteria

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

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

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

Event Timeline

Jdlrobson renamed this task from Simplify Toggler code to Simplify Toggler code so it doesn't use session storage.Sep 25 2024, 5:53 PM
Jdlrobson triaged this task as Medium priority.
Jdlrobson added a subscriber: Niedzielski.
Jdlrobson added subscribers: Esanders, SToyofuku-WMF.

can be removed given the back/forward cache is supported by all browsers now

Wait a second, wait a second. The back/forward cache is only a temporary thing that gets discarded by browsers after a little while (AFAIK mobile Firefox drops the bfcache after six minutes for example) and definitely on memory pressure or if the OS kills the whole browser process. So the bfcache is definitely *no* proper replacement for remembering the open section toggles and restoring the old scroll position.

Although to be honest the old code was definitely broken, too - the session storage mechanism didn't seem to survive the browser being killed by the OS, either, and even when it did work, the section toggles were expanded too late in relation to the browser attempting to restore the old scroll position, so Wikipedia pages where constantly losing their scroll position anyway.