Skip to content

[mediaqueries-4] make explicit that pointer, hover, any-pointer, any-hover relate only to pointing devices #973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

patrickhlauke
Copy link
Member

Closes #967

As `pointer`, `hover`, `any-pointer`, `any-hover` are only concerned
with pointing devices, don't use the more generic/all-encompassing
"input mechanism" (as that *would* cover things like keyboard, d-pads,
etc)

Also includes some very minor tweaks/corrections to existing
wording/formatting
@patrickhlauke
Copy link
Member Author

While in #967 i proposed "pointer-based input mechanisms", i saw that the spec already used "pointing devices" as a phrase, so for consistency went with this one...

@inoas
Copy link

inoas commented Jan 24, 2017

OT: So is iOS-Safari not behaving strict to the spec when it render elements you tap onto as having :hover triggered? Ref: http://codepen.io/anon/pen/jywdxM

@patrickhlauke
Copy link
Member Author

yours is a question more generally about the spec, and not about something in this PR, but:

iOS uses heuristics to make :hover apply under certain conditions after a user has tapped the screen, but it's undisputable that the touchscreen itself does not support actual hovering, and not every tap (e.g. on non-actionable elements) results in a hover behavior either.

see https://drafts.csswg.org/mediaqueries-4/#hover in reference to hover: none:

Pointing systems that can hover, but for which doing so is inconvenient and not part of the normal way they are used, also match this value

iOS' faked hovering would fall under this category.

In any case, this spec does not say either way when user agents should or shouldn't apply :hover...it specifies the hover media feature itself, which reflects the capabilities of the pointing device.

@inoas
Copy link

inoas commented Jan 24, 2017

OT/Noise: Maybe it could be helpful for the future to specify that touch-only (without 3d-touch / pressing sensitivity at least) devices are no pointing devices (as there is no real way to distinquish between pointing and clicking/tapping)...

The spec you are correcting also speaks about multiple devices. It should trigger :hover for the pointing device of highest priority, not just any primary device (imagine touch+pointing on the same screen, touch being the primary device?). It could also explicitly exclude non-pointing devices such as (2d) touch.

However it would be great to have :tap or :touch to be able differentiate.

@patrickhlauke
Copy link
Member Author

i think you're misunderstanding how the term "pointing device" is used here in the spec (and elsewhere, such as in https://w3c.github.io/pointerevents/). nothing to do with "pointing" as separate from potential activation.

If you do want to propose a new distinction/value for the media features here, i'd suggest opening a new issue.

Lastly, this spec does not deal with defining pseudo-classes like :hover or the hypothetical :tap / :touch you propose, so suggest actually going to https://drafts.csswg.org/selectors-4/ and proposing things there...

@inoas
Copy link

inoas commented Jan 24, 2017

Thanks for clarification! and the link to pointerevents

@patrickhlauke
Copy link
Member Author

as much as i hate pestering... @frivoal does this look ok to merge (based on your positive comment #967 (comment)) ?

@patrickhlauke
Copy link
Member Author

bumping this for @tabatkins' consideration as well...

@tabatkins
Copy link
Member

Looks pretty reasonable to me. @frivoal, any objections to merging?

@frivoal
Copy link
Collaborator

frivoal commented Mar 16, 2017

This is probably good, but I wonder: this is fine for any-* but what if the input mechanism deemed primary is not a pointing device? Say, a device with a keyboard deemed primary, and a gamepad. Should pointer match none because that's the case of the keyboard, or should it match coarse, because within the pointing devices, the gamepad, by virtue of being the only one, is necessarily primary, even if overall it wouldn't be?

This is possibly enough of a corner case not to matter, but I am not sure.

User Agents may also decide to dynamically change what type of input is deemed to be primary,
the number and type of pointing devices available,
and a notion of which of these is generally and/or currently being used.
User Agents may also decide to dynamically change what type of pointing device is deemed to be primary,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could add an extra example right here: "In situations where the primary input mechanism for a device is not a pointing device, but there is a secondary – and less frequently used – input that is a pointing devices, the user agent may decide to keep treating the non-pointing device as the primary (resulting in pointer: none), or they may opt to "promote" the secondary input to be identified as the primary pointing device (resulting in pointer: fine or pointer: coarse).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'd shorten it to this:

In situations where the primary input mechanism for a device is not a pointing device, but there is a secondary – and less frequently used – input that is a pointing devices, the user agent may decide to treat the non-pointing device as the primary (resulting in pointer: none).

If you can update the pull request with that, I'll merge.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Agree the terse versions works just as well.

@patrickhlauke
Copy link
Member Author

what if the input mechanism deemed primary is not a pointing device? Say, a device with a keyboard deemed primary, and a gamepad. Should pointer match none because that's the case of the keyboard, or should it match coarse, because within the pointing devices, the gamepad, by virtue of being the only one, is necessarily primary, even if overall it wouldn't be?

i'd say that's the remit of the UA to decide in that case. i'd tend to lean towards "if the UA deems the keyboard to be the primary input mechanism, and the gamepad is only used very infrequently, then there's no primary pointer, but only an any- pointer input. what about adding an extra example to that first note? (just added it as a comment)

basically...up to the UA, and this spec won't say what's right and it's up to the UA. or is that too handwavy?

@patrickhlauke
Copy link
Member Author

urgh, i seem to have completely messed up this pr by doing a rebase. let me see if i can fix that...

@patrickhlauke patrickhlauke force-pushed the mq4-pointer-hover-clarify-input-is-pointer branch from 22c2c31 to c10bef8 Compare March 17, 2017 10:54
Clarifies that it's again up to the UA to decide what to do in these
situations.
@frivoal frivoal merged commit d68b77b into w3c:master Mar 17, 2017
@frivoal frivoal self-assigned this Mar 17, 2017
triple-underscore added a commit to triple-underscore/triple-underscore.github.io that referenced this pull request Mar 17, 2017
[mediaqueries-4]
Merge pull request
w3c/csswg-drafts#973
from patrickhlauke/mq4-pointer-hover-clarify-input-is-pointer
w3c/csswg-drafts@d68b77b2c0cc706e3bc70f0192f8e
ae181be328d

Minor fix: change "User Agent" to "user agent"
w3c/csswg-drafts@11a6689aa1317e505a082307b9cdf
e95ec1a9de4

Minor typo "plaing" > "placing" (#1113)
w3c/csswg-drafts@53830b6c785db8cd72d06862561f7
cee646f6f48

Cover edge-case: primary input not pointer, secondary pointer
w3c/csswg-drafts@f350190fbfe8d33c84133d8dacdb9
a54f3fb59a6
@patrickhlauke patrickhlauke deleted the mq4-pointer-hover-clarify-input-is-pointer branch May 30, 2020 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants