Skip to content

The font-size setting resets on every page load and is not offered on mobile #220

Description

@mmcky

Found in the review of the #147 gate (study row F023). It is filed without a parent, because the text stays readable at the default size.

Problem

  • The choice isn't kept. The toolbar's font-size buttons change the page's root font size, but the choice lives only in React state and an inline style. A reload, a new tab or a fresh visit returns to the default. Measured on 2026-09-11 in Chromium, on lecture-python-programming's jb2 preview: 16px by default, 17.6px after one step up, 16px again after a reload.
  • There are no buttons on mobile. They are hidden md:block, and the mobile "More actions" menu has no font-size entry.

The book theme stores the choice in localStorage.toolbarFont and re-applies it on load (theme-settings.js L52-L88). Its steps are ×1.2 and ×0.9 (_base.scss L17-L64), where this theme uses 0.9rem and 1.1rem.

Where it happens.

Proposed change

  • Remember the choice. Store the step in localStorage (wrapped in try/catch), and apply it early enough that the text doesn't visibly jump after load.
  • Add it to the mobile menu.
  • Step sizes: decide whether to match the book theme's.
  • Keep it rem-based: the root stays at the browser default until a reader chooses, so the browser's own text-size setting still applies.

Acceptance criteria

  • A font-size choice survives a reload and applies on other pages of the same site.
  • The stored size is applied without a visible jump after the page loads.
  • The control is available in the mobile "More actions" menu.
  • A test covers persistence across a reload.

Context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to existing material

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions