<?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>29023</bug_id>
          
          <creation_ts>2015-08-03 17:11:40 +0000</creation_ts>
          <short_desc>Need clarification on what to do when an empty string or bad IDREF is found when processing aria-labelledby</short_desc>
          <delta_ts>2018-05-25 16:02:49 +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>AccName AAM</component>
          <version>1.1</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Alice Boxhall">aboxhall</reporter>
          <assigned_to name="Joseph Scheuhammer">clown</assigned_to>
          <cc>bryan.garaventa</cc>
    
    <cc>surkov.alexander</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>122415</commentid>
    <comment_count>0</comment_count>
    <who name="Alice Boxhall">aboxhall</who>
    <bug_when>2015-08-03 17:11:40 +0000</bug_when>
    <thetext>Some example cases:
&lt;div role=&quot;button&quot; aria-labelledby=&quot;i-dont-refer-to-anything&quot;&gt;Contents&lt;/div&gt;
&lt;div aria-label=&quot;ARIA label&quot; aria-labelledby=&quot;i-am-broken&quot;&gt;Contents&lt;/div&gt;
&lt;span id=&quot;foo&quot;&gt;&lt;/span&gt;&lt;div role=&quot;button&quot; aria-labelledby=&quot;foo&quot;&gt;Contents&lt;/div&gt;

Options:
1) Replace &quot;Return the accumulated text&quot; with &quot;If the accumulated text, as a flat string, is not empty, return the accumulated text&quot;
2) Before &quot;Set the current node to the node referenced by the IDREF&quot; add a step &quot;If the IDREF is not valid, continue to the next IDREF&quot; and &quot;Return the accumulated text&quot; with &quot;If any valid IDREF was found, return the accumulated text&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124187</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Scheuhammer">clown</who>
    <bug_when>2015-11-12 16:36:58 +0000</bug_when>
    <thetext>I think there are two issues here.

First, how to handle IDREFs that don&apos;t refer to anything:  IDs are used in other places such as CSS rules and named links:
- p#foo { text-align: center; }
- &lt;a href=&quot;www.somewhere.com/#bar&quot;&gt;

Without doing a deep dive into the specs, neither CSS nor HTML say what happens if the ID doesn&apos;t exist.  But, the implication is that if there is no &lt;p&gt; element with ID=&quot;foo&quot;, then that style is not applied.  And, if there is no element with id=&quot;bar&quot;, then the link goes nowhere.

Similarly for the text alternative computation (TAC).  If an element/id doesn&apos;t exist, then the accumulated text remains as is -- nothing is added to it.

However, it&apos;s possible that an implementation of the TAC may want detect this situation.  In that case, the result might &quot;null&quot; instead of &quot;the empty string&quot;.  That is, 
&quot;Set the current node to the node referenced by the IDREF.  If there is no such node, return &lt;null&gt;&quot;.

That would distinguish between a bad IDREF vs. a valid IDREF that results in the return of an empty string.

Would that distinction be useful?

A second issue is illustrated by your first example:
&lt;div role=&quot;button&quot; aria-labelledby=&quot;i-dont-refer-to-anything&quot;&gt;Contents&lt;/div&gt;

The TAC produces an empty string for the name of the button, which is useless.  FF produces &quot;Contents&quot; as the name of the button.  I suspect that FF is (1) calculating the name via the bad ID, and when it comes up empty, (2) re-runs the TAC as if the markup was &lt;div role=&quot;button&quot;&gt;Contents&lt;/div&gt;.

In other words, if the TAC fails to generate a name based on name-from-author, run it again using name-from-contents.

I&apos;m adding Alex to the CC list for his insights.

(Note:  the step in question is:
http://rawgit.com/w3c/aria/master/accname-aam/accname-aam.html#step2B)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124257</commentid>
    <comment_count>2</comment_count>
    <who name="alexander surkov">surkov.alexander</who>
    <bug_when>2015-11-18 21:22:21 +0000</bug_when>
    <thetext>I think wrong IDRefs should be ignored, and processed as they weren&apos;t present, since it&apos;s clearly an author error. I&apos;m not sure about empty aria-labelledby, I guess authors may want to put it on demand to say explicitly that an accessible doesn&apos;t have a name, similarly to what they do img@alt=&quot;&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129268</commentid>
    <comment_count>3</comment_count>
    <who name="Bryan Garaventa">bryan.garaventa</who>
    <bug_when>2018-05-25 16:02:49 +0000</bug_when>
    <thetext>This was most recently addressed at https://github.com/w3c/accname/issues/5 , so closing this here for now. Please address comments on GitHub against the AccName 1.2 milestone if anything is unclear.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>