W3C home > Mailing lists > Public > public-css-archive@w3.org > November 2016

Re: [csswg-drafts] [mediaqueries-4] Interaction Media Features make a rigid primary/"rare" distinction

From: Stu Cox via GitHub <sysbot+gh@w3.org>
Date: Tue, 08 Nov 2016 13:34:15 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-259137176-1478612053-sysbot+gh@w3.org>
Unfortunately web devs are lazy (I should know, I’m one of them) and 
will often take the shortest route / first SO answer to achieve what 
they’re after.

I like @patrickhlauke’s suggestion to make it clear that the 
definition of _“primary”_ might not always be in the user’s interests,
 but an effort would have to be made to communicate this across other 
references: MDN, SO answers, etc.

But I strongly agree that specifying a “primary” input at all is 
dangerous.

It’s highly likely `@media(pointer:coarse)` will proliferate as the 
recommended technique for [“detecting a 
touchscreen”](http://www.stucox.com/blog/you-cant-detect-a-touchscreen/),
 just like `'touchstart' in window` did, as devs will find this works 
fine for their immediate testing (likely just on a phone and a 
laptop), and they’ll ship it. People who struggle to use a 
trackpad/stylus accurately who have bought a laptop with a touchscreen
 for exactly this reason will be given a fiddly UI and have trouble 
with it, etc. Nothing about the API implied to the developer that this
 _wouldn’t_ be fine.

An alternative angle might be replacing “primary” with “current” — and
 hence encouraging UA implementors to switch based on _context_ rather
 than _device_, à la https://github.com/WICG/modality: if the user is 
currently using the mouse, `pointer: fine` matches — etc.

Benefits:

* Much less ambiguous than “primary”.
* For devices with a dominant input device, it will usually behave the
 same as “primary” (e.g. for users who only ever use the touchscreen 
their phone, `pointer: coarse` would always match).
* Facilitates more powerful, flexible UIs.
* Easier for end users to test their code, as they won’t have to find 
devices with the right “primary” configurations.
* More obvious how to combine with `any-*`: `pointer` and `hover` 
represent _dynamic_ behaviour, while `any-*` represent (relatively*) 
_static_ behaviour.

_\* Relatively, because values matched by an `any-*` query should 
ideally change if peripherals are connected/disconnected._


-- 
GitHub Notification of comment by stucox
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/690#issuecomment-259137176 
using your GitHub account
Received on Tuesday, 8 November 2016 13:34:22 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:05 UTC