Skip to content

Commit eaceee9

Browse files
scottaoharajcstehalice
authored
Describe best practices for inert="" in more detail
Closes #7796. Co-authored-by: James Teh <jamie@jantrid.net> Co-authored-by: Alice <95208+alice@users.noreply.github.com>
1 parent 2f6e75f commit eaceee9

File tree

2 files changed

+81
-14
lines changed

2 files changed

+81
-14
lines changed
21.5 KB
Loading

source

Lines changed: 81 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76119,14 +76119,16 @@ END:VCARD</pre>
7611976119

7612076120
<li><p>If it is <span>editable</span>, the node behaves as if it were non-editable.</p></li>
7612176121

76122-
<li><p>The user agent may ignore the node for the purposes of <span>find-in-page</span>.</p></li>
76122+
<li><p>The user agent should ignore the node for the purposes of <span>find-in-page</span>.</p></li>
7612376123
</ul>
7612476124

76125-
<p class="note">Inert nodes generally cannot be focused. Inert nodes that are <span
76126-
data-x="concept-command">commands</span> will also get disabled.</p>
76125+
<p class="note">Inert nodes generally cannot be focused, and user agents do not expose the inert
76126+
nodes to accessibility APIs or assistive technologies. Inert nodes that are <span
76127+
data-x="concept-command">commands</span> will become inoperable to users, in the manner described
76128+
above.</p>
7612776129

76128-
<p>User agents may allow the user to override the restrictions on search and text selection,
76129-
however.</p>
76130+
<p>User agents may allow the user to override the restrictions on <span>find-in-page</span> and
76131+
text selection, however.</p>
7613076132

7613176133
<p>By default, a node is not <span>inert</span>.</p>
7613276134

@@ -76156,19 +76158,84 @@ END:VCARD</pre>
7615676158
don't otherwise escape inertness (such as modal dialogs) are to be made <span>inert</span> by the
7615776159
user agent.</p>
7615876160

76159-
<p class="note">By default, there is no persistent visual indication of a subtree being inert.
76160-
Authors are encouraged to clearly mark what parts of their document are active and which are
76161-
inert, to avoid user confusion. In particular, it is worth remembering that not all users can see
76162-
all parts of a page at once; for example, users of screen readers, users on small devices or with
76163-
magnifiers, and even users using particularly small windows might not be able to see the active
76164-
part of a page and might get frustrated if inert sections are not obviously inert. For individual
76165-
controls, the <code data-x="attr-fe-disabled">disabled</code> attribute is probably more
76161+
<p>An inert subtree should not contain any content or controls which are critical to
76162+
understanding or using aspects of the page which are not in the inert state. Content in an inert
76163+
subtree will not be perceivable by all users, or interactive. Authors should not specify elements
76164+
as inert unless the content they represent are also visually obscured in some way. In most cases,
76165+
authors should not specify the <code>inert</code> attribute on individual form controls. In these
76166+
instances, the <code data-x="attr-fe-disabled">disabled</code> attribute is probably more
7616676167
appropriate.</p>
7616776168

76168-
<p>The <dfn data-x="dom-inert"><code>inert</code></dfn> IDL attribute must <span>reflect</span>
76169-
the content attribute of the same name.</p>
76169+
<div class="example">
76170+
<p>The following example shows how to mark partially loaded content, visually obscured by a
76171+
"loading" message, as inert.</p>
76172+
76173+
<pre><code class="html">&lt;section aria-labelledby=s1>
76174+
&lt;h3 id=s1>Population by City&lt;/h3>
76175+
&lt;div class=container>
76176+
&lt;div class=loading>&lt;p>Loading...&lt;/p>&lt;/div>
76177+
&lt;div inert>
76178+
&lt;form>
76179+
&lt;fieldset>
76180+
&lt;legend>Date range&lt;/legend>
76181+
&lt;div>
76182+
&lt;label for=start>Start&lt;/label>
76183+
&lt;input type=date id=start>
76184+
&lt;/div>
76185+
&lt;div>
76186+
&lt;label for=end>End&lt;/label>
76187+
&lt;input type=date id=end>
76188+
&lt;/div>
76189+
&lt;div>
76190+
&lt;button>Apply&lt;/button>
76191+
&lt;/div>
76192+
&lt;/fieldset>
76193+
&lt;/form>
76194+
&lt;table>
76195+
&lt;caption>From 20-- to 20--&lt;/caption>
76196+
&lt;thead>
76197+
&lt;tr>
76198+
&lt;th>City&lt;/th>
76199+
&lt;th>State&lt;/th>
76200+
&lt;th>20-- Population&lt;/th>
76201+
&lt;th>20-- Population&lt;/th>
76202+
&lt;th>Percentage change&lt;/th>
76203+
&lt;/tr>
76204+
&lt;/thead>
76205+
&lt;tbody>
76206+
&lt;!-- ... -->
76207+
&lt;/tbody>
76208+
&lt;/table>
76209+
&lt;/div>
76210+
&lt;/div>
76211+
&lt;/section></code></pre>
76212+
76213+
<img src="/images/inert-example-loading-section.png" width="947" height="243" alt="Screenshot of Population by City content with an overlaid loading message which visually obscures the form controls and data table which have not fully rendered, and thus are in the inert state.">
7617076214

76215+
<p>The "loading" overlay obscures the inert content, making it visually apparent that the inert
76216+
content is not presently accessible. Notice that the heading and "loading" text are not
76217+
descendants of the element with the <code>inert</code> attribute. This will ensure this text is
76218+
accessible to all users, while the inert content cannot be interacted with by anyone.</p>
76219+
</div>
76220+
76221+
<div class="note">
76222+
<p>By default, there is no persistent visual indication of an element or its subtree being
76223+
inert. Appropriate visual styles for such content is often context-dependent. For instance, an
76224+
inert off-screen navigation panel would not require a default style, as its off-screen position
76225+
visually obscures the content. Similarly, a modal <code>dialog</code> element's backdrop will
76226+
serve as the means to visually obscure the inert content of the web page, rather than styling
76227+
the inert content specifically.</p>
7617176228

76229+
<p>However, for many other situations authors are strongly encouraged to clearly mark what parts
76230+
of their document are active and which are inert, to avoid user confusion. In particular, it is
76231+
worth remembering that not all users can see all parts of a page at once; for example, users of
76232+
screen readers, users on small devices or with magnifiers, and even users using particularly
76233+
small windows might not be able to see the active part of a page and might get frustrated if
76234+
inert sections are not obviously inert.</p>
76235+
</div>
76236+
76237+
<p>The <dfn data-x="dom-inert"><code>inert</code></dfn> IDL attribute must <span>reflect</span>
76238+
the content attribute of the same name.</p>
7617276239

7617376240
<h3>Tracking <dfn export>user activation</dfn></h3>
7617476241

0 commit comments

Comments
 (0)