@@ -272,14 +272,21 @@ Selectors Overview</h2>
272272 <tr>
273273 <td><code> E:hover</code>
274274 <td> an E element that is under the cursor,
275- or that has a descendant under the cursor
275+ or that has a descendant under the cursor
276276 <td> [[#useraction-pseudos]]
277277 <td> 2
278278 <tr>
279279 <td><code> E:focus</code>
280280 <td> an E element that has user input focus
281281 <td> [[#useraction-pseudos]]
282282 <td> 2
283+ <tr>
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
287+ should be drawn for that element
288+ <td> [[#useraction-pseudos]]
289+ <td> 4
283290 <tr>
284291 <td><code> E:drop</code>
285292 <td> an E element that can possibly receive a drop
@@ -2019,9 +2026,9 @@ The Activation Pseudo-class: '':active''</h3>
20192026<h3 id="the-focus-pseudo">
20202027The Input Focus Pseudo-class: '':focus''</h3>
20212028
2022- The <dfn id='focus-pseudo'>:focus</dfn> pseudo-class applies while an element
2023- has the focus (accepts keyboard or mouse events, or other forms of
2024- input).
2029+ The <dfn id='focus-pseudo'>:focus</dfn> pseudo-class applies
2030+ while an element has the focus
2031+ (accepts keyboard or mouse events, or other forms of input).
20252032
20262033 There may be document language or implementation specific limits on
20272034 which elements can acquire '':focus'' .
@@ -2031,6 +2038,68 @@ The Input Focus Pseudo-class: '':focus''</h3>
20312038 the same ways must apply to elements matching '':focus'' as well,
20322039 except that the parent of an element that matches '':focus'' must not match '':focus'' .
20332040
2041+ <h3 id="the-focusring-pseudo">
2042+ The Input Focus-Ring Pseudo-class: '':focus-ring''</h3>
2043+
2044+ The <dfn id='focus-ring-pseudo'>:focus-ring</dfn> pseudo-class applies
2045+ while an element matches the '':focus'' pseudo-class,
2046+ <em> and</em> the UA determines via heuristics
2047+ that the focus should be specially indicated on the element
2048+ (typically via a "focus ring").
2049+
2050+ <div class=example>
2051+ For example, UAs typically display focus indicators on text elements
2052+ <em> whenever</em> they're focused,
2053+ to draw attention to the fact that keyboard input will affect their contents.
2054+
2055+ On the other hand, they typically only display focus indicators on buttons
2056+ when they were focused by a keyboard interaction
2057+ (such as tabbing thru the document),
2058+ because it's not always immediately obvious where the focus will move
2059+ after such an interaction,
2060+ but not when they were focused by more "obvious" interactions,
2061+ like clicking on the button with a mouse pointer.
2062+ </div>
2063+
2064+ <div class=advisement>
2065+ Page authors should follow these guidelines
2066+ when deciding whether to use '':focus'' or '':focus-ring''
2067+ to style the focused state of an element:
2068+
2069+ * If the element has "native" focus indicator behavior
2070+ (such as text fields or buttons),
2071+ use '':focus-ring'' .
2072+ * Otherwise, if the element is emulating a text input,
2073+ or something else that is <em> intended</em> to receive keyboard interaction,
2074+ use '':focus'' .
2075+ * Otherwise,
2076+ use '':focus-ring'' .
2077+ </div>
2078+
2079+ When UAs choose to specially indicate focus on an element,
2080+ or whether they specially indicate focus at all,
2081+ is UA-dependent.
2082+ Different UAs,
2083+ the same UA on different operating systems,
2084+ or the same UA on the same OS,
2085+ but with different user settings,
2086+ can make different choices as to when an element matches '':focus-ring'' .
2087+
2088+ <div class=example>
2089+ The following guidelines are suggested heuristics
2090+ for choosing when to apply '':focus-ring''
2091+ to elements without "native" focus ring behavior:
2092+
2093+ * If the element received focus via a keyboard interaction,
2094+ including indirectly,
2095+ such as triggering a dialog
2096+ by pressing a button using the keyboard,
2097+ apply '':focus-ring'' .
2098+ * If a keyboard event occurs while an element is focused,
2099+ even if the element wasn't focused by a keyboard interaction,
2100+ apply '':focus-ring'' .
2101+ </div>
2102+
20342103<h3 id="the-focus-within-pseudo">
20352104The Generalized Input Focus Pseudo-class: '':focus-within''</h3>
20362105
0 commit comments