Description
Relates to https://drafts.csswg.org/mediaqueries-4/#any-input
A more focused successor to #737, only covering any-hover
(as I can now rationalise better why any-pointer
behaves the way it does, which I tried to more explicitly point out in #842)
any-hover
, as currently specified, only evaluates to none
when ALL detected pointing mechanisms are non-hover-capable. This currently makes it impossible to query specifically if some, but not all, of the pointing mechanisms is non-hover-capable (or conversely, to test if ALL detected pointing mechanisms are hover-capable)
Assuming two or more pointing devices are present, you can currently only test:
- at least one of the devices is hover-capable -
any-hover:hover
will evaluate to true (and currently, regardless of whether any of the other pointing devices is non-hover-capable,any-hover:none
will be false) - none of the devices is hover-capable -
any-hover:hover
will evaluate to false,any-hover:none
evaluates to true
Scenarios that can't be tested (as they return the same as the "at least one..." scenario above):
- at least one, but /not/ all, device is non-hover-capable -
any-hover:hover
will evaluate to true,any-hover:none
will evaluate to false - /all/ devices are hover-capable -
any-hover:hover
will evaluate to true,any-hover:none
will evaluate to false
As the UA should be able to ascertain the total number of pointing devices (since it needs to know this in order to properly evaluate any-pointer
, presumably), it should be possible (and not require some special "we need to define what an input is" additional consideration, which was the major argument against #737) to also change when any-hover:none
evaluates as follows:
- if ANY inputs are present that are non-hover capable,
any-hover: none
should evaluate to true - if ANY inputs are present that are hover capable,
any-hover: hover
should evaluate to true - if ALL inputs that are present are non-hover capable,
any-hover: none
should be true andany-hover: hover
should be false - if ALL inputs that are present are hover capable,
any-hover: none
should be false andany-hover: hover
should be true - if a mix of hover-capable and non-hover capable inputs is present, both
any-hover: none
andany-hover: hover
should evaluate to true
Going back to the original scenarios, this would then allow to capture all possible states:
- at least one of the devices is hover-capable -
any-hover:hover
will evaluate to true (as before) - none of the devices is hover-capable -
any-hover:hover
will evaluate to false,any-hover:none
evaluates to true (as before) - at least one, but /not/ all, device is non-hover-capable -
any-hover:hover
will evaluate to true,any-hover:none
will also evaluate to true; this is a new capability that couldn't be tested before - /all/ devices are hover-capable -
any-hover:hover
will evaluate to true,any-hover:none
will evaluate to false; this is also a new capability that couldn't be tested before (with the change tonone
, this now actually gives you confidence in theany-hover:none
to mean "none of the pointing devices is non-hover-capable)