<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>29283</bug_id>
          
          <creation_ts>2015-11-14 02:18:02 +0000</creation_ts>
          <short_desc>Label elements containing controls</short_desc>
          <delta_ts>2018-05-03 21:19:24 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>ARIA</product>
          <component>HTML AAM</component>
          <version>1.0</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cynthia Shelly">cyns</reporter>
          <assigned_to name="steve faulkner">faulkner.steve</assigned_to>
          <cc>clown</cc>
    
    <cc>jason</cc>
    
    <cc>surkov.alexander</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>124200</commentid>
    <comment_count>0</comment_count>
    <who name="Cynthia Shelly">cyns</who>
    <bug_when>2015-11-14 02:18:02 +0000</bug_when>
    <thetext>see also: https://www.w3.org/WAI/PF/Group/track/issues/754

Do we use label elements that contain controls? Maybe only if the control is the first child of the label?

 &lt;label&gt;I have a &lt;input type=”checkbox” /&gt;checkbox and a &lt;button&gt;button&lt;/button&gt; here&lt;/label&gt;

 I don’t think the label containing these controls makes sense to be the name for either, and definitely not both.

Please add a concrete definition of when to use parent &lt;label&gt; elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124248</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Scheuhammer">clown</who>
    <bug_when>2015-11-17 18:00:31 +0000</bug_when>
    <thetext>&gt; Do we use label elements that contain controls? Maybe only if the control is
&gt; the first child of the label?

Your intuition matches the HTML5.1 nightly [1].  If a &lt;label&gt; element has no @for attribute, then the &quot;... the first such descendant in tree order is the label element&apos;s labeled control.&quot; One of the spec&apos;s examples is:

&lt;label&gt;&lt;input type=checkbox name=lost&gt; Lost&lt;/label&gt;

The accessible name of the checkbox accessible for the above is &quot;Lost&quot;.

Based on that, in your example, the &lt;label&gt; applies only to the checkbox &lt;input&gt;.  Repeating your example here:

&lt;label&gt;I have a &lt;input type=”checkbox” /&gt;checkbox and a &lt;button&gt;button&lt;/button&gt; here&lt;/label&gt;

The accessible name for the checkbox accessible is &quot;I have a checkbox and a button here&quot;.

Since the &lt;label&gt; does not apply to the (enclosed) &lt;button&gt;, then its accessible name should be &quot;button&quot;.

FWIW, FF produces &quot;I have a checkbox and a button here&quot; as the accessible name for *both* the checkbox and the button.


[1] http://www.w3.org/html/wg/drafts/html/master/single-page.html#the-label-element</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124258</commentid>
    <comment_count>2</comment_count>
    <who name="alexander surkov">surkov.alexander</who>
    <bug_when>2015-11-18 21:26:24 +0000</bug_when>
    <thetext>btw, I filed a bug for firefox issue https://bugzilla.mozilla.org/show_bug.cgi?id=1226000</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124261</commentid>
    <comment_count>3</comment_count>
    <who name="alexander surkov">surkov.alexander</who>
    <bug_when>2015-11-19 16:54:24 +0000</bug_when>
    <thetext>I think the a11y spec should refer to the HTML spec, saying that labelled control takes its accessible name from its label element [1], and related with it by certain accessible relations.

[1] http://www.w3.org/html/wg/drafts/html/master/single-page.html#labeled-control</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129194</commentid>
    <comment_count>4</comment_count>
    <who name="James Nurthen">w3cbugzilla</who>
    <bug_when>2018-05-03 21:19:24 +0000</bug_when>
    <thetext>HTML AAM is no longer an ARIA Deliverable. If you wish to pursue this issue please file at https://github.com/w3c/html-aam/issues</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>