Page MenuHomePhabricator

Monospace font settings messed up in certain browsers
Closed, InvalidPublic

Description

"pre, code, tt { font-family: monospace, sans-serif; }" has been added as a workaround for bug 20706.

This workaround is problematic because it exploits a Mozilla bug (https://bugzilla.mozilla.org/show_bug.cgi?id=175415). It causes the following new problems:

(1) Mozilla users can no longer adjust the size of monospaced fonts independently of sans-serif fonts because Mozilla will use the configured size of sans-serif fonts even for monospaced fonts. This "fixes" bug 20706 just because Mozilla's default size for sans-serif fonts is 16px while the default size of monospaced fonts is 13px.
(2) It doesn't always work because some other css rules (extensions, local customizations, inline style attributes of templates etc.) may override it with "font-family: monospace", effectively removing the "sans-serif" that triggers the Mozilla behaviour. <pre> elements inserted by the SyntaxHighlight GeSHi extension are an example of this (bug 23708). In order to have it at least consistent, the workaround would have to be added *everywhere*.
(3) It will stop working when the Mozilla bug is fixed.

Google Chrome seems to behave exactly like Mozilla in this regard btw. (same default sizes, same bug as Mozilla).


Version: unspecified
Severity: normal

Details

Reference
bz23951

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:05 PM
bzimport set Reference to bz23951.

After some more research, this workaround turns out to be widely used on the web to circumvent bad defaults and unpredictable/inconsistent rendering across browsers (see http://www.brunildo.org/test/monospace_fsize.html and the links there), so the option to configure monospaced fonts differently that some browsers offer isn't very useful anyway. Therefore closing as invalid because removing it would probably cause more problems than doing good.