Specify behavior when following a hidden subtree via aria-labelledby … · w3c/accname@3efa7de (original) (raw)

`@@ -249,11 +249,42 @@

Computation steps

`

249

249

`

  • Set the root node to the given element, the current node to the root node, and the total accumulated text to the empty string (""). If the root node's role prohibits naming, return the empty string ("").
  • `

    250

    250

    `

  • Compute the text alternative for the current node:
  • `

    251

    251

    `

      `

      252

      ``

      `-

    1. If the current node is hidden and is not directly referenced by aria-labelledby or aria-describedby, nor directly referenced by a native host language text alternative element (e.g. label in HTML) or attribute, return the empty string.

      `

      ``

      252

      `+

    2. If the current node is hidden and is:

      `

      ``

      253

      `+

        `

        ``

        254

        `+

      • Not part of an aria-labelledby or aria-describedby traversal, where the node directy referenced by that relation was hidden.
      • `

        ``

        255

        `+

      • Nor part of a native host language text alternative element (e.g. label in HTML) or attribute traversal, where the root of that traversal was hidden.
      • `

        ``

        256

        `+

      `

      ``

      257

      `+

      Return the empty string.

      `

      ``

      258

      `+

      `

      ``

      259

      `+

      Comment:

      `

      ``

      260

      `+

      It's important to clarify the broad definition of hidden for the purposes of accessible name calculation:

      `

      ``

      261

      `+

        `

        ``

        262

        `+

      • Nodes with CSS properties display:none, visibility:hidden, visibility:collapse or content-visibility:hidden: They are considered hidden, as they match the guidelines "not perceivable" and "explicitly hidden".
      • `

        ``

        263

        `+

      • Nodes with CSS properties opacity:0 or filter:opacity(0%), or similar SVG mechanisms: They are not considered hidden. Text hidden with these methods can still be selected or copied, and user agents still expose it in their accessibility trees.
      • `

        ``

        264

        `+

      • Nodes with the aria-hidden="true" property: it is considered hidden, matching the "explicitly hidden" guideline.
      • `

        ``

        265

        `+

      • Nodes hidden off screen or behind another object: they are not considered hidden. They are exposed in the accessibility tree and they can even name on-screen objects.
      • `

        ``

        266

        `+

      `

      ``

      267

      `+

      `

      253

      268

      `

      `

      254

      269

      `

      Comment:

      `

      255

      270

      `

      By default, assistive technologies do not relay hidden information, but an author can explicitly override that and include hidden text as part of the accessible name or accessible description by using aria-labelledby or aria-describedby.

      `

      256

      271

      `

      `

      ``

      272

      `+

      `

      ``

      273

      `+

      Example:

      `

      ``

      274

      `+

      The following examples show the meaning of the clause "Not part of an aria-labelledby or aria-describedby traversal, where the node directy referenced by that relation was hidden.".

      `

      ``

      275

      `+

      First, element1's accessible name is "hello" because, although element3 is hidden, it is part of an aria-labelledby traversal started in element2, which is hidden too.

      `

      ``

      276

      `+

      <element1 id="el1" role="button" aria-labelledby="el2" />
      
      `
      
      ``
      
      `277`
      
      `+
      
      <element2 id="el2" class="hidden">
      
      `
      
      ``
      
      `278`
      
      `+
      
       <element3 id="el3" class="hidden">hello</element3>
      
      `
      
      ``
      
      `279`
      
      `+
      
      </element2>
      
      `
      
      ``
      
      `280`
      
      `+
      
      

      `

      ``

      281

      `+

      Alternatively, element1 has no accessible name if element3 is hidden and it is part of an aria-labelledby traversal started in element2, but element2 is not hidden.

      `

      ``

      282

      `+

      <element1 id="el1" role="button" aria-labelledby="el2" />
      
      `
      
      ``
      
      `283`
      
      `+
      
      <element2 id="el2">
      
      `
      
      ``
      
      `284`
      
      `+
      
       <element3 id="el3" class="hidden">hello</element3>
      
      `
      
      ``
      
      `285`
      
      `+
      
      </element2>
      
      `
      
      ``
      
      `286`
      
      `+
      
      

      `

      ``

      287

      `+

      `

      257

      288

      `

    3. `

      258

      289

      `

    4. Otherwise:
    5. `

      259

      290

      `

    `

    273

    304

    `

    `

    274

    305

    `

    `

    ``

    306

    `+

    `

    ``

    307

    `+

    Comment:

    `

    ``

    308

    `+

    The result of step 2B.ii.b in combination with step 2A means that user agents MUST include all nodes in the subtree as part of the accessible name or accessible description, when the node referenced by aria-labelledby or aria-describedby is hidden.

    `

    275

    309

    `

    `

    276

    310

    `

    Example:

    `

    277

    311

    `

    The following example shows the meaning of the clause "… and the current node is not already part of an aria-labelledby traversal …" .

    `