Skip to content

Commit

Permalink
[] (0) Handle elements losing focus when they are hidden, etc.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@2804 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 13, 2009
1 parent 3429247 commit 457f1d5
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 22 deletions.
68 changes: 57 additions & 11 deletions index
Expand Up @@ -35875,7 +35875,8 @@ explain that only direct children of the <menu> matter


<li><code><a href=#the-command>command</a></code> elements that do not have a <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute</li> <li><code><a href=#the-command>command</a></code> elements that do not have a <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute</li>


<li>any other element, if it is <a href=#focusable>focusable</a></li> <li>any other element, if it is <a href=#specially-focusable>specially
focusable</a></li>


</ul> </ul>


Expand Down Expand Up @@ -35926,7 +35927,8 @@ explain that only direct children of the <menu> matter
first such element's <a href=#command-facet-disabledstate title=command-facet-disabledstate>Disabled State</a> facet first such element's <a href=#command-facet-disabledstate title=command-facet-disabledstate>Disabled State</a> facet
is false (not disabled)</li> is false (not disabled)</li>


<li>any other element, if it is <a href=#focusable>focusable</a></li> <li>any other element, if it is <a href=#specially-focusable>specially
focusable</a></li>


</ul> </ul>


Expand Down Expand Up @@ -45444,13 +45446,11 @@ at the first element with the given ID must be treated as if it was cloned and r


</dl> </dl>


<p>An element is <dfn id=focusable>focusable</dfn> if the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute's definition above <p>An element is <dfn id=specially-focusable>specially focusable</dfn> if the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute's definition above
defines the element to be focusable <em>and</em> the element is defines the element to be focusable.</p>
<span>being rendered</span><!-- XXX xref, define display:none as not
being rendered, off-screen as being rendered? -->.</p>


<p>An element that is <a href=#focusable>focusable</a> but does not otherwise <p>An element that is <a href=#specially-focusable>specially focusable</a> but does not
have an <a href=#activation-behavior>activation behavior</a> defined has an otherwise have an <a href=#activation-behavior>activation behavior</a> defined has an
<a href=#activation-behavior>activation behavior</a> that does nothing.</p> <a href=#activation-behavior>activation behavior</a> that does nothing.</p>


<p class=note>This means that an element that is only focusable <p class=note>This means that an element that is only focusable
Expand All @@ -45459,6 +45459,44 @@ at the first element with the given ID must be treated as if it was cloned and r
to a non-mouse activation (e.g. hitting the "enter" key while the to a non-mouse activation (e.g. hitting the "enter" key while the
element is focused).</p> element is focused).</p>


<p>An element is <dfn id=focusable>focusable</dfn> if the user agent's default
behavior allows it to be focusable or if the element is
<a href=#specially-focusable>specially focusable</a>, but only if the element is
<span>being rendered</span><!-- XXX xref, define display:none,
orphan nodes as not being rendered, off-screen as being rendered?
-->.</p>

<p>User agents should make the following elements
<a href=#focusable>focusable</a>, unless platform conventions dictate
otherwise:</p>

<ul>

<li><code><a href=#the-a-element>a</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li>

<li class=XXX><code><a href=#the-area-element>area</a></code> elements that have an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute</li> <!-- should
define the behavior in the face of multiple images and in the face
of no images -->

<li><code><a href=#the-link-element>link</a></code> elements that have an <code title=attr-link-href><a href=#attr-link-href>href</a></code> attribute</li>

<li><code><a href=#the-bb-element>bb</a></code> elements whose <code title=attr-bb-type><a href=#attr-bb-type>type</a></code> attribute is in a state whose
<i>relevance</i> is true</li>

<li><code><a href=#the-button-element>button</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

<li><code><a href=#the-input-element>input</a></code> elements whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute are not in the
<a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state and that
are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

<li><code><a href=#the-select-element>select</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

<li><code><a href=#the-textarea-element>textarea</a></code> elements that are not <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a></li>

<li><code><a href=#the-command>command</a></code> elements that do not have a <code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code> attribute</li>

</ul>

<p>The <dfn id=dom-tabindex title=dom-tabIndex><code>tabIndex</code></dfn> DOM <p>The <dfn id=dom-tabindex title=dom-tabIndex><code>tabIndex</code></dfn> DOM
attribute must <a href=#reflect>reflect</a> the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> content attribute. If the attribute must <a href=#reflect>reflect</a> the value of the <code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code> content attribute. If the
attribute is not present, or parsing its value returns an error, attribute is not present, or parsing its value returns an error,
Expand Down Expand Up @@ -45518,9 +45556,17 @@ at the first element with the given ID must be treated as if it was cloned and r


</ol> </ol>


<p>User agents should run the <a href=#unfocusing-steps>unfocusing steps</a> for an <p>When the user moves the focus away from a <a href=#focusable>focusable</a>
element whenever the user moves the focus away from any element, the user agent should run the <a href=#unfocusing-steps>unfocusing steps</a>
<a href=#focusable>focusable</a> element.</p> that element.</p>

<p>When an element that is focused stops being a
<a href=#focusable>focusable</a> element, the user agent should run the
<a href=#unfocusing-steps>unfocusing steps</a> that element.</p>

<p class=example>For example, this might happen because the
element is removed from its <code>Document</code>, or has a <code title=attr-hidden><a href=#the-hidden-attribute>hidden</a></code> attribute added. It would also
happen to an <code><a href=#the-input-element>input</a></code> element when the element gets <a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a>.</p>




<h4 id=document-level-focus-apis><span class=secno>6.5.3 </span>Document-level focus APIs</h4> <h4 id=document-level-focus-apis><span class=secno>6.5.3 </span>Document-level focus APIs</h4>
Expand Down
79 changes: 68 additions & 11 deletions source
Expand Up @@ -38255,7 +38255,8 @@ explain that only direct children of the <menu> matter
<li><code>command</code> elements that do not have a <code <li><code>command</code> elements that do not have a <code
title="attr-command-disabled">disabled</code> attribute</li> title="attr-command-disabled">disabled</code> attribute</li>


<li>any other element, if it is <span>focusable</span></li> <li>any other element, if it is <span>specially
focusable</span></li>


</ul> </ul>


Expand Down Expand Up @@ -38318,7 +38319,8 @@ explain that only direct children of the <menu> matter
title="command-facet-disabledstate">Disabled State</span> facet title="command-facet-disabledstate">Disabled State</span> facet
is false (not disabled)</li> is false (not disabled)</li>


<li>any other element, if it is <span>focusable</span></li> <li>any other element, if it is <span>specially
focusable</span></li>


</ul> </ul>


Expand Down Expand Up @@ -48613,14 +48615,12 @@ at the first element with the given ID must be treated as if it was cloned and r


</dl> </dl>


<p>An element is <dfn>focusable</dfn> if the <code <p>An element is <dfn>specially focusable</dfn> if the <code
title="attr-tabindex">tabindex</code> attribute's definition above title="attr-tabindex">tabindex</code> attribute's definition above
defines the element to be focusable <em>and</em> the element is defines the element to be focusable.</p>
<span>being rendered</span><!-- XXX xref, define display:none as not
being rendered, off-screen as being rendered? -->.</p>


<p>An element that is <span>focusable</span> but does not otherwise <p>An element that is <span>specially focusable</span> but does not
have an <span>activation behavior</span> defined has an otherwise have an <span>activation behavior</span> defined has an
<span>activation behavior</span> that does nothing.</p> <span>activation behavior</span> that does nothing.</p>


<p class="note">This means that an element that is only focusable <p class="note">This means that an element that is only focusable
Expand All @@ -48629,6 +48629,53 @@ at the first element with the given ID must be treated as if it was cloned and r
to a non-mouse activation (e.g. hitting the "enter" key while the to a non-mouse activation (e.g. hitting the "enter" key while the
element is focused).</p> element is focused).</p>


<p>An element is <dfn>focusable</dfn> if the user agent's default
behavior allows it to be focusable or if the element is
<span>specially focusable</span>, but only if the element is
<span>being rendered</span><!-- XXX xref, define display:none,
orphan nodes as not being rendered, off-screen as being rendered?
-->.</p>

<p>User agents should make the following elements
<span>focusable</span>, unless platform conventions dictate
otherwise:</p>

<ul>

<li><code>a</code> elements that have an <code
title="attr-hyperlink-href">href</code> attribute</li>

<li class="XXX"><code>area</code> elements that have an <code
title="attr-hyperlink-href">href</code> attribute</li> <!-- should
define the behavior in the face of multiple images and in the face
of no images -->

<li><code>link</code> elements that have an <code
title="attr-link-href">href</code> attribute</li>

<li><code>bb</code> elements whose <code
title="attr-bb-type">type</code> attribute is in a state whose
<i>relevance</i> is true</li>

<li><code>button</code> elements that are not <span
title="concept-fe-disabled">disabled</span></li>

<li><code>input</code> elements whose <code
title="attr-input-type">type</code> attribute are not in the
<span title="attr-input-type-hidden">Hidden</span> state and that
are not <span title="concept-fe-disabled">disabled</span></li>

<li><code>select</code> elements that are not <span
title="concept-fe-disabled">disabled</span></li>

<li><code>textarea</code> elements that are not <span
title="concept-fe-disabled">disabled</span></li>

<li><code>command</code> elements that do not have a <code
title="attr-command-disabled">disabled</code> attribute</li>

</ul>

<p>The <dfn title="dom-tabIndex"><code>tabIndex</code></dfn> DOM <p>The <dfn title="dom-tabIndex"><code>tabIndex</code></dfn> DOM
attribute must <span>reflect</span> the value of the <code attribute must <span>reflect</span> the value of the <code
title="attr-tabindex">tabindex</code> content attribute. If the title="attr-tabindex">tabindex</code> content attribute. If the
Expand Down Expand Up @@ -48693,9 +48740,19 @@ at the first element with the given ID must be treated as if it was cloned and r


</ol> </ol>


<p>User agents should run the <span>unfocusing steps</span> for an <p>When the user moves the focus away from a <span>focusable</span>
element whenever the user moves the focus away from any element, the user agent should run the <span>unfocusing steps</span>
<span>focusable</span> element.</p> that element.</p>

<p>When an element that is focused stops being a
<span>focusable</span> element, the user agent should run the
<span>unfocusing steps</span> that element.</p>

<p class="example">For example, this might happen because the
element is removed from its <code>Document</code>, or has a <code
title="attr-hidden">hidden</code> attribute added. It would also
happen to an <code>input</code> element when the element gets <span
title="concept-fe-disabled">disabled</span>.</p>




<h4>Document-level focus APIs</h4> <h4>Document-level focus APIs</h4>
Expand Down

0 comments on commit 457f1d5

Please sign in to comment.