You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[selectors] Clarify that the 'match if descendants match' user-input pseudos work on the flat tree, and work if a non-element node matches (like hovering over text).
Copy file name to clipboardExpand all lines: selectors/Overview.bs
+25-16Lines changed: 25 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -282,8 +282,8 @@ Selectors Overview</h2>
282
282
<td>2
283
283
<tr>
284
284
<td><code>E:focus-ring</code>
285
-
<td>an E element that has user input focus,
286
-
and the UA has determined that a focus ring or other indicator
285
+
<td>an E element that has user input focus,
286
+
and the UA has determined that a focus ring or other indicator
287
287
should be drawn for that element
288
288
<td>[[#useraction-pseudos]]
289
289
<td>4
@@ -1989,7 +1989,10 @@ The Pointer Hover Pseudo-class: '':hover''</h3>
1989
1989
(e.g., a pen device that does not detect hovering)
1990
1990
are still conforming.
1991
1991
1992
-
An element also matches '':hover'' if one of its <a>shadow-including descendants</a> matches '':hover''.
1992
+
An element also matches '':hover''
1993
+
if one of its descendants in the <a>flat tree</a>
1994
+
(including non-element nodes, such as text nodes)
1995
+
matches the above conditions.
1993
1996
1994
1997
Document languages may define additional ways in which an element can match '':hover''.
1995
1998
For example, [[HTML5]] defines a labeled control element as <a href="http://www.whatwg.org/html/selectors.html#selector-hover">matching <code>:hover</code></a>
@@ -2016,7 +2019,10 @@ The Activation Pseudo-class: '':active''</h3>
2016
2019
which elements can become '':active''.
2017
2020
For example, [[HTML5]] defines a <a href="http://www.whatwg.org/html/selectors.html#selector-active">list of activatable elements</a>.
2018
2021
2019
-
An element also matches '':active'' if one of its <a>shadow-including descendants</a> matches '':active''.
2022
+
An element also matches '':active''
2023
+
if one of its descendants in the <a>flat tree</a>
2024
+
(including non-element nodes, such as text nodes)
2025
+
matches the above conditions.
2020
2026
2021
2027
Document languages may define additional ways in which an element can match '':active''.
2022
2028
@@ -2026,8 +2032,8 @@ The Activation Pseudo-class: '':active''</h3>
2026
2032
<h3 id="the-focus-pseudo">
2027
2033
The Input Focus Pseudo-class: '':focus''</h3>
2028
2034
2029
-
The <dfn id='focus-pseudo'>:focus</dfn> pseudo-class applies
2030
-
while an element has the focus
2035
+
The <dfn id='focus-pseudo'>:focus</dfn> pseudo-class applies
2036
+
while an element has the focus
2031
2037
(accepts keyboard or mouse events, or other forms of input).
2032
2038
2033
2039
There may be document language or implementation specific limits on
@@ -2046,26 +2052,26 @@ The Input Focus-Ring Pseudo-class: '':focus-ring''</h3>
2046
2052
<em>and</em> the UA determines via heuristics
2047
2053
that the focus should be specially indicated on the element
2048
2054
(typically via a "focus ring").
2049
-
2055
+
2050
2056
<div class=example>
2051
2057
For example, UAs typically display focus indicators on text elements
2052
2058
<em>whenever</em> they're focused,
2053
2059
to draw attention to the fact that keyboard input will affect their contents.
2054
-
2060
+
2055
2061
On the other hand, they typically only display focus indicators on buttons
2056
2062
when they were focused by a keyboard interaction
2057
-
(such as tabbing thru the document),
2063
+
(such as tabbing thru the document),
2058
2064
because it's not always immediately obvious where the focus will move
2059
2065
after such an interaction,
2060
2066
but not when they were focused by more "obvious" interactions,
2061
2067
like clicking on the button with a mouse pointer.
2062
2068
</div>
2063
-
2069
+
2064
2070
<div class=advisement>
2065
2071
Page authors should follow these guidelines
2066
2072
when deciding whether to use '':focus'' or '':focus-ring''
2067
2073
to style the focused state of an element:
2068
-
2074
+
2069
2075
* If the element has "native" focus indicator behavior
2070
2076
(such as text fields or buttons),
2071
2077
use '':focus-ring''.
@@ -2075,7 +2081,7 @@ The Input Focus-Ring Pseudo-class: '':focus-ring''</h3>
2075
2081
* Otherwise,
2076
2082
use '':focus-ring''.
2077
2083
</div>
2078
-
2084
+
2079
2085
When UAs choose to specially indicate focus on an element,
2080
2086
or whether they specially indicate focus at all,
2081
2087
is UA-dependent.
@@ -2084,12 +2090,12 @@ The Input Focus-Ring Pseudo-class: '':focus-ring''</h3>
2084
2090
or the same UA on the same OS,
2085
2091
but with different user settings,
2086
2092
can make different choices as to when an element matches '':focus-ring''.
2087
-
2093
+
2088
2094
<div class=example>
2089
2095
The following guidelines are suggested heuristics
2090
-
for choosing when to apply '':focus-ring''
2096
+
for choosing when to apply '':focus-ring''
2091
2097
to elements without "native" focus ring behavior:
2092
-
2098
+
2093
2099
* If the element received focus via a keyboard interaction,
2094
2100
including indirectly,
2095
2101
such as triggering a dialog
@@ -2105,7 +2111,10 @@ The Generalized Input Focus Pseudo-class: '':focus-within''</h3>
2105
2111
2106
2112
The <dfn id='focus-within-pseudo'>:focus-within</dfn> pseudo-class applies to elements for which the '':focus'' pseudo class applies.
2107
2113
2108
-
An element also matches '':focus-within'' if one of its <a>shadow-including descendants</a> matches '':focus''.
2114
+
An element also matches '':focus-within''
2115
+
if one of its descendants in the <a>flat tree</a>
2116
+
(including non-element nodes, such as text nodes)
2117
+
matches the conditions for matching '':focus''.
2109
2118
2110
2119
<h3 id="drag-pseudos">
2111
2120
The Drag-and-Drop Pseudo-class: '':drop'' and '':drop()''</h3>
0 commit comments