- From: Eric A. Meyer <eric@meyerweb.com>
- Date: Tue, 23 Oct 2012 22:51:13 -0400
- To: www-style@w3.org
Greetings,
There's an inconsistency in browser behavior that's always bugged
me, which is the way browsers treat hovering. According to
<http://dev.w3.org/csswg/selectors4/#the-hover-pseudo> (as well as
earlier versions back to original CSS2, with minor variations in
punctuation):
"The :hover pseudo-class applies while the user designates an
element with a pointing device, but does not necessarily activate it."
This seems to vaguely argue for :hover only applying if there is
evidence of user intent; i.e., the mouse pointer is moving. That's
how most browsers currently behave. Gecko, at least for a good many
versions now, does not. See this testcase by Kyle Weems:
<http://cssquirrel.com/testcases/css-animation-hover/>
(I am told the described Gecko behavior may not be true in recent
builds of Gecko, but I'm not clear if that's intentional or not.)
I think most people-- I've seen this in many cases-- assume that
hovering always means that the pointer is over the element,
regardless of how the two came to be in that state. In this mental
model, the pointer is like a helicopter and the element is like a
flatbed truck. The helicopter hovers over the truck whether it flies
over the truck or the truck is driven under it.
I understand that the only-check-when-moving behavior of most
browsers is probably a performance optimization, but it clashes with
author expectations. The specification, as I say, vaguely implies
that author expectations should be subverted here, but that's quite
possibly reading too much into the text.
I propose the text be clarified to say what should happen if an
unmoving pointer is within the bounds of an element with a :hover
style. The actual text depends on what the WG intends to be the
right outcome in this case, though. What is the preferred outcome?
--
Eric A. Meyer (eric@meyerweb.com) http://meyerweb.com/
Received on Wednesday, 24 October 2012 02:51:37 UTC