Repository navigation
Update :active and :hover definitions - #7465
Conversation
This matches Gecko and WebKit. The disabled condition was added to the spec in 9985973 but not implemented uniformly. As discussed in #6635, it doesn't work very well and is inconsistent with other similar pseudo-classes, like :hover. This also removes the consideration of <link> elements with href="" attributes, since they no longer have activation behavior as of 1e0ee7f. And it updates the definitions of both :active and :hover to be based on the latest Selectors spec, which notably includes the ancestor condition over the flat tree at the CSS layer, instead of having HTML handle that. There remains some lack of interop around elements such as <input type=radio> which have activation behavior but are not on the list of elements for which "in a formal activation state" is considered. #6635 stays open to track that case.
annevk
left a comment
There was a problem hiding this comment.
I don't think the change for :hover works. This would mean that any ancestor of a labeled control of a label element that matchines :hover would also match :hover.
I'm also surprised these use the flat tree, though I suppose that makes some sense given the way events work.
|
Yeah, indeed that is not the case. https://jsbin.com/dibasoqali/edit?html,output I guess we need to separately define "matching :hover" (works on labels) and "while the user designates". |
annevk
left a comment
There was a problem hiding this comment.
The changes to :hover look good. It seems however that we need corresponding changes for :active. Sorry for not spotting that at the same time.
|
Alright, I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1287171 and hopefully that will cause some WPTs to get written, so we can merge this. |
|
WPTs here: web-platform-tests/wpt#32804 |
|
Yay, thanks so much! I'll merge this now. |
This removes the disabled condition for :active, matching Gecko and WebKit. The condition was added to the spec in 9985973 but not implemented uniformly. As discussed in whatwg#6635, it doesn't work very well and is inconsistent with other similar pseudo-classes, like :hover. This also removes the consideration of <link> elements with href="" attributes for :active, since they no longer have activation behavior as of 1e0ee7f. Finally, this updates the definitions of both :active and :hover to be based on the latest Selectors spec, which notably includes the ancestor condition over the flat tree at the CSS layer, instead of having HTML handle that. This required splitting up "being activated" and "matches :active", as well as "designated" and "matches :hover". Closes whatwg#6635, although note that there remain other interop issues with :active, tracked in whatwg#7578.
This removes the disabled condition for :active, matching Gecko and WebKit. The condition was added to the spec in 9985973 but not implemented uniformly. As discussed in #6635, it doesn't work very well and is inconsistent with other similar pseudo-classes, like :hover.
This also removes the consideration of
<link>elements with href="" attributes for :active, since they no longer have activation behavior as of 1e0ee7f.Finally, this updates the definitions of both :active and :hover to be based on the latest Selectors spec, which notably includes the ancestor condition over the flat tree at the CSS layer, instead of having HTML handle that. This required splitting up "being activated" and "matches :active", as well as "designated" and "matches :hover".
Closes #6635, although note that there remain other interop issues with :active, tracked in #7578.
(See WHATWG Working Mode: Changes for more details.)
We could consider resolving the
<input type=radio>case alongside this one in a single PR, but for now I'm tackling this alone./semantics-other.html ( diff )