https://bugzilla.wikimedia.org/show_bug.cgi?id=53734

Ori Livneh <o...@wikimedia.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |o...@wikimedia.org

--- Comment #9 from Ori Livneh <o...@wikimedia.org> ---
In jquery.webfonts.js:

    if ( !fontFamily ) {
        // If there is no explicit font for this language, it will
        // inherit the webfont for the parent.  But that is undesirable here
        // since language is different. So inherit the original font of the
        // element. Define it explicitly so that inheritance is broken.
        // element
        fontFamily = webfonts.originalFontFamily;
    }

The logic you're seeing is this:
- There's no font to apply for this language.
- If we don't specify a font, the element could inherit a webfont from a
parent.
- So we have to explicitly specify the default font.
- The default font is the font-family for body, which is 'sans-serif'.

The catch is this: most browsers do not apply inherited font-family styles to
form elements by default, as a way of protecting the consistency of input
interfaces.

To prevent this special-casing of form elements, you have to explicitly
specify:

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

References:
http://www.komodomedia.com/blog/2006/10/css-trickery-part-5-inheritance/
http://stackoverflow.com/questions/6520689/font-family-is-not-inherited-to-the-form-input-fields

The easy way to fix this would be to exempt form elements in the if (
!fontFamily ) { /* ... */ } block in jquery.webfonts.js.

If we move in the direction of explicitly specifying fonts, it would be
arguably better / more correct to specify that form elements should inherit
font styles. But the existence of this bug demonstrates that this would be
surprising to users.

I think it'd be best to fix it in jquery.webfonts.js and then start a separate
bug thread to discuss the second option.

I also note that I think the if ( !fontFamily ) ... check is overzealous; it
should only explicitly apply the default font stylings to elements are
descendants of elements that have a WebFonts specified. DOM manipulation is
expensive, even if it is a no-op from the perspective of the page's appearance.
It should be possible to be a bit cleverer about inheritance and only apply the
defaults when absolutely required.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to