Page MenuHomePhabricator

Resizing the window doesn't impact table of contents display
Closed, ResolvedPublic

Description

Some code exists that loads table of contents, if a user resizes their window above the tablet threshold.

Replication steps

  • Load browser in mobile resolution e.g. 320x480
  • Verify in browser JS console that mw.loader.getState('skins.minerva.tablet.scripts') === 'registered'
  • Resize window to desktop resolution e.g. 1200*800
  • Verify that mw.loader.getState('skins.minerva.tablet.scripts') === 'ready' and a table of contents is present in the screen at the bottom of the lead section

Acceptance criteria

  • The code adding the resize handler is dropped in Minerva OR the table of contents is successfully loaded after a resize.

Developer notes

The function loadTabletModules() is wired up correctly and code lives in resources/skins.minerva.scripts/init.js, however loadTabletModules is a memoized function

isWideScreen: memoize( function () {

There are 2 solutions here

  1. Drop the resize handler inside Minerva. Only the width at the time of page load will be used.
  2. Whenever resize is called, invalidate the cached isWidescreen function.