Page MenuHomePhabricator

Don't override site authors' styles by using inline style in UniversalLanguageSelector
Closed, ResolvedPublic


Author: michael

The ULS specifies fonts by injecting inline style sheets into the DOM.

This overrides site style sheets, takes control away from site authors and administrators, as well as readers, including those using accessibility technology, and encourages authors to use the harmful !important CSS keyword.

An example of the problem: on en.wiktionary there is a mature framework of classes used to set fonts by script code, alongside the use of HTML lang attributes. The ULS randomly interferes with this.

For example, in the page Fraktur, a passage of text is specified as <span class="Latf" lang="de"> to set it in a Fraktur font. The class .Latf applies font-family: UnifrakturMaguntia, a web font that is *provided by the ULS.*

The ULS adds a style="font-family: sans-serif;" which would be needless otherwise, but in en.Wiktionary overrides the authors’ CSS which resides in MediaWiki:Common.css

How are authors supposed to reliably specify correct fonts? How are authors supposed to specify web fonts provided by the ULS? Why are fonts specified with inline CSS, which robs all control from authors? Why is German-language text specifically formatted as sans-serif?

The ULS should operate using the standard framework of lang attributes, classes, and style sheets instead of inline CSS, providing authors, editors, readers, and users of accessibility technology with several avenues to control or override its behaviour.

Version: unspecified
Severity: normal
See Also:



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:10 AM
bzimport set Reference to bz54453.

michael wrote:


Bug 39992 - ULS: Don't set inline "font-family: sans-serif" when no fonts are specified

By design, ULS tries to give priority to user custom font styles. It is supposed to apply inline font only when no such styles exist. In this specific case, it is not respected and I confirm the bug. This is a regression from and I am working on it. Thanks.

(For record, this is the same commit cause this bug too:

dmitrismirnov wrote:

Template lang creates bad effect: it shows a different sort of font that looks much bigger that other text around it. It was not like this about two months ago.
Here is only one an example (but there are thousands like this):


dmitrismirnov wrote:

Yes, now it is OK. Thanks!!! ~~~~