Page MenuHomePhabricator

Mobile view overrides paragraph font-size via clientpref classes, blocking custom styling
Open, MediumPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Go to נידה יד א on Hebrew Wikisource using a mobile view (Minerva skin).
  • In the mobile menu (≡), choose any font size preference (small, medium, or large).
  • Observe the main text and commentary (Gemara vs. Rashi) which are supposed to differ in font size due to surrounding <div> styling (135% vs. 120%).

What happens?:

The font-size styling applied through surrounding <div>s does not affect the text inside <p> elements. This happens due to the following CSS (which changes slightly based on font size selection):

.mf-font-size-clientpref-small .mw-body p,
.mf-font-size-clientpref-small .content p {
    font-size: 1rem;
}

This rule is overly specific and forces a fixed font size on paragraph (<p>) elements, making it impossible for external styling (via wrapping <div>s or custom classes) to modify the appearance of paragraph text. The override essentially blocks site-level or user-level control of font sizes inside paragraphs, which is especially problematic for content that relies on layered or structured text, like Talmudic or biblical commentary.

A significant observation: this forced styling only targets <p> elements. As a result, any content rendered using other HTML elements, such as <dl> (e.g., created by a colon : indentation in wikitext), is not affected and responds correctly to external styling.

For example:

This highlights a deeper design issue: targeting only <p> tags for global font overrides is fragile and leads to inconsistent behavior. It introduces side effects based on the HTML structure generated by wikitext syntax (e.g., whether text appears in a <p> or <dl>), rather than on semantic or contextual logic. A more robust approach would apply scaling in a way that allows child elements to override it where necessary.

What should have happened instead?:

Mobile font preferences (small, medium, large) should not forcefully override all paragraph font sizes in a way that blocks local site styling. External or wrapping styles (e.g., .gemara { font-size: 135% }) should still be respected within content.

At minimum, there should be a way for local or site-level CSS to cleanly override the preference without using workarounds, such as: .mw-body p { font-size: unset !important; }, which is only practical for site maintainers or advanced users.

Desktop (Vector 2022) behaves as expected – custom styling applies normally and font-size is inherited from parent elements or overridden styles without conflict.

Software version:

WMF-hosted wikis (tested on he.wikisource.org)

Other information:

Tested on:

  • Android (Chrome)
  • Minerva skin on mobile view, on Chrome for desktop
  • Font preference set via mobile sidebar (small, medium, or large)

Event Timeline

Jdlrobson-WMF triaged this task as Medium priority.
Jdlrobson-WMF moved this task from Incoming to Freezer on the Web-Team board.
Jdlrobson-WMF subscribed.

Tagging DST in case it is useful for their discussions around font scaling.

Jdrewniak added subscribers: Alien333, Jdrewniak.

I'm adding the reader experience team tag since we just got a similar report: T401137
In addition to generalizing this beyond the <p> element, I think this value could potentially be swapped with a codex design token too.
e.g.

.mf-font-size-clientpref-small .mw-body,
.mf-font-size-clientpref-small .content {
    font-size: @font-size-medium;
}