Skip to content

Commit a46a1ed

Browse files
committed
Add section about when to draw or not a focus ring
This section describes a set of heuristics to determine if the currently focused element should have or not a focus ring.
1 parent 22e821b commit a46a1ed

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

source

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74349,6 +74349,42 @@ END:VCARD</pre>
7434974349
<pre><code class="html">&lt;div contenteditable autofocus&gt;Edit &lt;strong>me!&lt;/strong>&lt;div></code></pre>
7435074350
</div>
7435174351

74352+
<h4>Focus rings</h4>
74353+
74354+
<p>User agents should <dfn>indicate focus</dfn>, such as by drawing a focus ring and matching
74355+
<code>:focus-visible</code>, on the currently focused element in the following situations:</p>
74356+
74357+
<ul>
74358+
<li><p>If the user has expressed a preference (such as via a system preference or a browser
74359+
setting) to always see a visible focus indicator. (Another option may be for the user agent to
74360+
show its own focus indicator regardless of author styles.)</p></li>
74361+
74362+
<li>
74363+
<p>If the currently focused element is a <i>text control</i>, an <span>editing host</span> or
74364+
an <span>editable</span> element.</p>
74365+
74366+
<p>For the purpose of this point, a <i>text control</i> is a <code>textarea</code> element or
74367+
an <code>input</code> element whose <code data-x="attr-input-type">type</code> attribute is in
74368+
one of the
74369+
<span data-x="attr-input-type-email">Email</span>,
74370+
<span data-x="attr-input-type-password">Password</span>,
74371+
<span data-x="attr-input-type-search">Search</span>,
74372+
<span data-x="attr-input-type-text">Text</span>, or
74373+
<span data-x="attr-input-type-url">URL</span>
74374+
states.</p>
74375+
74376+
<p>The user agent may draw a focus ring in other elements.</p>
74377+
</li>
74378+
74379+
<li><p>If the user interacts with the page via keyboard or some other non-pointing device,
74380+
<span>indicate focus</span>. (This means keyboard usage may change whether the focus ring is
74381+
drawn even if focus isn't affected).</p></li>
74382+
74383+
<li><p>If a script caused focus to be set, and the previous time the <span>focus update
74384+
steps</span> have been run <var>focus trigger</var> was not "<code
74385+
data-x="">click</code>".</p></li>
74386+
</ul>
74387+
7435274388

7435374389

7435474390
<h3>Assigning keyboard shortcuts</h3>

0 commit comments

Comments
 (0)