From 619691c056bdc1add642c7a53dc08f97f0eaae75 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 10 Feb 2022 14:06:48 -0500 Subject: [PATCH] Update :active and :hover definitions (#7465) This removes the disabled condition for :active, matching Gecko and WebKit. The condition was added to the spec in 998597345d884fbc6482bf72f66d3a25b11e289d 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 elements with href="" attributes for :active, since they no longer have activation behavior as of 1e0ee7fc1aa490212a8655ceccaf12accb5b9be9. 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. --- source | 114 ++++++++++++++++++++++++++------------------------------- 1 file changed, 51 insertions(+), 63 deletions(-) diff --git a/source b/source index 5b9a2c97a30..aef0705c87f 100644 --- a/source +++ b/source @@ -70790,41 +70790,30 @@ contradict people?
:active

The :active pseudo-class is defined to - match an element - while an - element is being activated by the user.

+ match an element while an + element is being activated by the + user.

-

To determine whether a particular element is being activated for the purposes of - defining the :active pseudo-class only, an - HTML user agent must use the first relevant entry in the following list.

+

To determine whether a particular element is being + activated for the purposes of defining the :active + pseudo-class only, an HTML user agent must use the first relevant entry in the + following list.

-
If the element has a descendant that is currently matching the :active pseudo-class
-

The element is being activated.

- - - -
If the element is the labeled control of a label element that is - currently matching :active
-

The element is being activated.

- - -
If the element is a button element
If the element is an input element whose type attribute is in the Submit Button, Image Button, Reset Button, or Button state
+
If the element is an a element that has an href attribute
+
If the element is an area element that has an href attribute
+
If the element is focusable
-

The element is being activated if it is in a formal activation state - and it is not disabled.

+

The element is being activated if it is in a + formal activation state.

For example, if the user is using a keyboard to push a button element by pressing the space bar, the element would match this pseudo-class in @@ -70832,16 +70821,6 @@ contradict people? event and the time the element received the keyup event.

-
If the element is an a element that has an href attribute
-
If the element is an area element that has an href attribute
-
If the element is a link element that has an href attribute
-
If the element is focusable
-

The element is being activated if it is in a formal activation - state.

-
If the element is being actively pointed at

The element is being activated.

@@ -70856,31 +70835,37 @@ contradict people? element using a pointing device while that pointing device is in the "down" state (e.g. for a mouse, between the time the mouse button is pressed and the time it is depressed; for a finger in a multitouch environment, while the finger is touching the display surface).

+ +

Per the definition in Selectors, :active also matches flat tree ancestors of + elements that are being activated.

+ +

Additionally, any element that is the labeled control of a label + element that is currently matching :active, also matches + :active. (But, it does not count as being being activated.)

:hover
-

The :hover pseudo-class is defined to match - an element while the - user designates an element with a pointing device. For the purposes of defining the - :hover pseudo-class only, an HTML user agent - must consider an element as being one that the user designates if it is:

+

The :hover pseudo-class is defined to + match an element while the user + designates an element with a pointing + device. For the purposes of defining the :hover + pseudo-class only, an HTML user agent must consider an element as being one that + the user designates if it is an element that the user + indicates using a pointing device.

-