Page MenuHomePhabricator

Misleading comment regarding preformatted font in commonElements.css
Closed, ResolvedPublic

Description

Patch for commonElements.css

commonElements.css contains the following (annoyingly wrong) comment:

  • It's important for this rule to first reference an actual font name, some browsers will render the monospace text
  • too small otherwise, namely Firefox, Chrome and Safari

However, the rule refers to a generic font-family first for a reason: to trigger the correct font rendering behaviour *without* forcing a specific font. This patch has an updated comment:

  • Some browsers will render the monospace text too small, namely Firefox, Chrome and Safari.
  • Specifying any valid, second value will trigger correct behaviour without forcing a different font.

It also changes '"Courier New"' to just 'Courier', which works equally well (as the font is never selected anyway).


Version: 1.20.x
Severity: enhancement

Attached:

Details

Reference
bz33496

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:07 AM
bzimport set Reference to bz33496.
bzimport added a subscriber: Unknown Object (MLST).

r108112 (After testing font name on w3's CSS validator)

Thanks for the clarification Erwin!

You're welcome!

I actually gained some insight behind this 'bug' after viewing the test page. It's actually not a bug, but a result of the combination of a website's default font size and the browsers default font size for monospace.

By default, a (Windows) browser has it's default font-sizes set at 16px for serif and sans-serif, and 13px for monospace. Except in IE, where you cannot set any font-sizes... it uses 16px for all fonts.

Vector has a base font-size of 0.8em, and most browsers *correctly* scale down all fonts, including the monospace font, accordingly. So monospace is shown at 0.8 x 13px = 10px (which is perceived as 'too small'). But when you assign any font besides just "monospace", those browsers will no longer treat it as monospace and use 0.8 x 16px = 13px instead.

Another mystery solved.

I have added your comment in r108142 :-D

@Edokter after five years, I am still referring to this bug and MediaWiki /docs/uidesign/monospace.html :-}

As much as I think this was a useful resource, I don't think it really belongs in MediaWiki core.
I'd rather remove the HTML page here (and move it somewhere else…).
Thoughts, hard feelings anyone?