Re: [css3-mediaqueries] device-* media features are actively harmful

Andi Sidwell wrote:
> Maybe feedback time for Media Queries is over, but here goes.
> 
> The device-* media features in CSS3 Media Queries are actively harmful 
> for authors and leak information that has no need to be exposed via CSS.
> 
> In a situation I recently encountered, a page developer had written 
> special rules for mobile devices.  However, they had written one of them 
> testing against max-device-width rather than just max-width.  The 
> outcome of this was that the page looked fine in a desktop browser when 
> squashing the viewport down to 240px, but had display issues when viewed 
> on a mobile device of that width.  This issue took quite a while to 
> track down after it was first submitted as a bug on the mobile's browser 
> itself by the developer.
> 
> I don't think this will be an atypical case if and when media features 
> are more widely used.   Copy-and-paste will be used and authors won't 
> test adequately, ultimately resulting in quirks for mobile users that 
> developers on the lower end of the authoring ladder won't find obvious. 
>  (The end result could well be that mobile browsers start reporting 
> device-width and width as being the same to work round bad authoring 
> practice.)
> 
> Henri Sivonen has also raised the point that pages can use the 
> difference between device-width and max-device width to display annoying 
> messages to users saying "maximise this window please".  Pages really 
> have no business knowing the size of the user's display.
> 
> 
> As a result, it would be good if the spec was changed to either remove 
> device-*, or define when as equivalent to their non-device-* 
> counterparts for backwards-compat.

I'm not convinced we should do that, but perhaps the spec can include a note
explaining that in most cases, authors should be avoiding the device-*
features unless they really need to query the device for something. Tutorials
on Media Queries should either leave out the device-* queries (and let people
who really need them look them up elsewhere), or mention them along with a
warning that they should not be used in the general case.

~fantasai

Received on Wednesday, 26 August 2009 19:10:03 UTC