-
Notifications
You must be signed in to change notification settings - Fork 756
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:hoverwill evaluate to true (and currently, regardless of whether any of the other pointing devices is non-hover-capable,any-hover:nonewill be false) - none of the devices is hover-capable -
any-hover:hoverwill evaluate to false,any-hover:noneevaluates 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:hoverwill evaluate to true,any-hover:nonewill evaluate to false - /all/ devices are hover-capable -
any-hover:hoverwill evaluate to true,any-hover:nonewill 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: noneshould evaluate to true - if ANY inputs are present that are hover capable,
any-hover: hovershould evaluate to true - if ALL inputs that are present are non-hover capable,
any-hover: noneshould be true andany-hover: hovershould be false - if ALL inputs that are present are hover capable,
any-hover: noneshould be false andany-hover: hovershould be true - if a mix of hover-capable and non-hover capable inputs is present, both
any-hover: noneandany-hover: hovershould 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:hoverwill evaluate to true (as before) - none of the devices is hover-capable -
any-hover:hoverwill evaluate to false,any-hover:noneevaluates to true (as before) - at least one, but /not/ all, device is non-hover-capable -
any-hover:hoverwill evaluate to true,any-hover:nonewill also evaluate to true; this is a new capability that couldn't be tested before - /all/ devices are hover-capable -
any-hover:hoverwill evaluate to true,any-hover:nonewill 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:noneto mean "none of the pointing devices is non-hover-capable)