W3C home > Mailing lists > Public > www-style@w3.org > August 2014

[mediaqueries] Unintuitive evaluation in boolean context

From: David Bokan <bokan@google.com>
Date: Wed, 13 Aug 2014 12:01:12 -0400
Message-ID: <CANMmsAuZMx6UnpyGR=yXkn8sxzt710WAJRM9_6Phf5p_qrmqEA@mail.gmail.com>
To: www-style@w3.org
Hello,

I'm implementing the newly added any-hover and any-pointer media
features in Media Queries Level 4. When it comes to evaluating these
features in a boolean context, I find the specified behavior to be
unintuitive. From the spec on evaluating in a boolean context (2.4.2):

"If the feature would be true for the number 0, a dimension with the
value 0, or the keyword none, the media feature evaluates to false. If
it would be true for any values other than the above, it evaluates to
true. Otherwise, it evaluates to false."

This means if a user has a mouse and some other non-pointing input
device (e.g. voice recognition?), '@media (any-pointer)' would
evaluate to false. As a developer, I would expect that to evaluate to
true if there is any pointing device available to the UA. This could
be made intuitive by changing the order of the statements in the spec:

"If it would be true for any values other than the number 0, a
dimension with the value 0, or the keyword none, it evaluates to true.
If the feature would be true for any of the values above, the media
feature evaluates to false. Otherwise, it evaluates to false."

Is the existing ordering intentional? As far as I can tell this
wouldn't affect any other media features.

Thanks,
David
Received on Wednesday, 13 August 2014 16:47:54 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 13 August 2014 16:47:55 UTC