Skip to content

Chameleon does not declare itself "responsive" to MW core, and produces an extra/ambiguous viewport meta tag #470

@mdoggydog

Description

@mdoggydog

MW has a mechanism for declaring whether or not a skin is "responsive": setting the responsive option when the skin (Skin class) is constructed. Once a skin is declared to be responsive, users can individually specify whether or not they want responsiveness, and the joint result is exposed via the public function Skin::isResponsive().

Based on the result of Skin::isResponsive(), MW adds one of two <meta> tags to page output:

  • If isResponsive: <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0"/>
  • If not isResponsive: <meta name="viewport" content="width=1000"/>

(See Skin::initPage().)

Chameleon is a responsive skin, but it does not tell that to the MW core via the responsive option to Skin. Instead, it manually adds a viewport specification to the page output, via Chameleon::initPage() (after calling parent::initPage():

  • <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

As a result:

  1. the MW core and other extensions will always get a false result from Skin::isResponsive(), and consider chameleon to be not-responsive.
  2. Every wiki page has two viewport tags, with competing width values: 1000 from MW core, and device-width from chameleon.

I noticed this because chrome-based browsers on Android (e.g., Chromium, Vanadium, Brave) appear to favor the width=1000 depending on the page content. E.g., pages with long unbroken strings (like visible URLs) are mysteriously rendered as "unresponsive" fixed-width.

My recommendations for fixing this:

  • Add 'responsive' => true to the list of options to Chameleon in SetupAfterCache::registerSkinWithMW().
  • Remove Chameleon::initPage() (since all it does is add the superfluous viewport tag).

(These recommendations appear to work for me.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions