From 0923fc807a79d433c814aac305553fd0a1705a37 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 5 Jan 2022 16:42:45 -0500 Subject: [PATCH] Update :active definition to not consider disabledness This matches Gecko and WebKit. The disabled 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, since they no longer have activation behavior as of 1e0ee7fc1aa490212a8655ceccaf12accb5b9be9. 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 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. --- source | 63 +++++++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/source b/source index 462d636ea3c..5b6cfadc3ad 100644 --- a/source +++ b/source @@ -70731,41 +70731,33 @@ 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.

-
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 @@ -70773,16 +70765,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.

@@ -70797,31 +70779,36 @@ 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.

: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:

+ +

Per the definition in Selectors, :hover also matches flat tree ancestors of elements + that are designated.