cms-alchemy/textsize-control

Drupal module providing dynamic user-controlled text scaling with intelligent fallback strategies.

Maintainers

Package info

github.com/DanielMoody/textsize_control

Language:JavaScript

Type:drupal-module

pkg:composer/cms-alchemy/textsize-control

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-03-30 01:01 UTC

This package is auto-updated.

Last update: 2026-05-01 00:16:54 UTC


README

A lightweight Drupal module that provides user-adjustable text scaling with intelligent fallback strategies.

This module adds a small floating UI (A- / A / A+) that allows users to dynamically adjust text size across the site. It is designed to work across a wide range of themes, including those that rely on rem, em, or fixed px units.

Installation

composer require cms-alchemy/textsize-control
drush en textsize_control

Features

  • Persistent text scaling via localStorage
  • Three scaling strategies:
    • Root font-size scaling (preferred)
    • Class-based scaling fallback
    • Transform-based scaling (last resort)
  • Automatic detection of whether scaling is effective
  • Minimal UI injected on page load
  • No configuration required

How It Works

The module attaches a Drupal behavior that:

  1. Injects a control UI into the page (A-, A, A+)
  2. Tracks the current scale and mode in localStorage
  3. Applies scaling using a CSS variable (--text-scale)
  4. Attempts scaling in this order:
    • Root (html { font-size })
    • Class-based (.textsize-mode-class)
    • Transform (scale())

If root scaling does not visibly affect the page, the module automatically falls back to alternative methods.