MAIDR JavaScript API
    Preparing search index...

    Function htmlFontSizeFor

    • Works out the typography.htmlFontSize that gives MAIDR's dialogs the text size they have on a page that leaves the root font size alone.

      Only a root smaller than the reader's default is compensated for. A page that enlarges its root has always enlarged MAIDR's dialogs along with its own text, and still does: larger text is never the hazard here, and undoing a host's choice to show it would be a regression for the readers it was made for. The reader's default font size, not a fixed 16px, is the reference, so a reader who has asked their browser for larger text keeps it on a page that shrinks the root, as they do on any other.

      Anything that is not a positive size -- a font size the browser did not report -- leaves MUI's default in place.

      Parameters

      • rootFontSize: number

        The root element's computed font size, in px

      • defaultFontSize: number

        The reader's default font size (CSS medium), in px

      Returns number

      The value for MUI's typography.htmlFontSize