Last modified: 2013-10-23 18:17:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40586, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38586 - Media queries not respected in skins
Media queries not respected in skins
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.18.x
All All
: Unprioritized minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-22 21:05 UTC by Peter Richardson
Modified: 2013-10-23 18:17 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Peter Richardson 2012-07-22 21:05:05 UTC
Media queries are ignored when included in a skin's css file and loaded through load.php.

To test: add a style declaration in a media query to a skin's screen.css:

@media screen {
  body {background-color: orange;}
}

The only browser I've found where the style is respected in Firefox 14.0.1, on Mac and PC.

Media queries function as expected when added to MediaWiki:Common.css.

If the css file is added directly to the header with a <style> tag, media queries function as expected.
Comment 1 Roan Kattouw 2012-07-23 20:34:17 UTC
Your skin resource definition probably looks something like:

'skins.vector' => array(
	'styles' => array(
		'common/commonElements.css' => array( 'media' => 'screen' ),
		'common/commonContent.css' => array( 'media' => 'screen' ),
		'common/commonInterface.css' => array( 'media' => 'screen' ),
		'vector/screen.css' => array( 'media' => 'screen' ),
	),
	'scripts' => 'vector/vector.js',
	'remoteBasePath' => $GLOBALS['wgStylePath'],
	'localBasePath' => $GLOBALS['wgStyleDirectory'],
),

As you can see, each file is already assigned a media type. Trying to use @media blocks in those files will result in nested @media blocks, so obviously that doesn't work. If you're in a skin and you want something to apply to a specific media type, put it in a separate file and declare the media type in the resource definition. Either that or omit the media type in the resource definition and you'll be able to use @media blocks.
Comment 2 Peter Richardson 2012-07-23 21:51:15 UTC
Understood, thank you.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links