Support aria-description (#69) · w3c/accname@81361ec (original) (raw)

`@@ -200,22 +200,70 @@

Name and Description

`

200

200

`

author

`

201

201

`

name is generated from values provided by the author in explicit markup features such as the aria-label and aria-labelledby [=attribute=], or a host language labeling mechanism, such as the alt or title [=attribute=] in HTML, or the desc [=element=] in SVG.

`

202

202

`

contents

`

203

``

`-

name is generated from the Text [=nodes=] associated with the [=element=]. Although this may be allowed in addition to "author" in some roles, "content" is used only if higher priority "author" features are not provided. Priority is defined by the accessible name and description computation algorithm.

`

``

203

`+

name is generated from the Text [=nodes=] associated with the [=element=]. Although this may be allowed in addition to "author" in some roles, "content" is used only if higher priority "author" features are not provided. Priority is defined by the text equivalent computation algorithm.

`

204

204

`

prohibited

`

205

205

`

the element has no name. Authors MUST NOT use the aria-label or aria-labelledby attributes to name the element.

`

206

206

`

`

207

207

`

The Accessible Rich Internet Applications (WAI-ARIA) 1.2 [[!WAI-ARIA]] specification provides lists of roles that support name from author, roles that support name from content and roles that cannot be named.

`

208

208

`

`

209

209

`

Name Computation

`

210

``

`-

User agents MUST compute an accessible name using the rules outlined below in the section titled Accessible Name and Description Computation.

`

``

210

`+

User agents MUST compute an accessible name using the rules outlined below in the section titled Text Equivalent Computation.

`

211

211

`

`

``

212

+

212

213

`

`

213

214

`

Description Computation

`

214

``

`-

If aria-describedby is present, user agents MUST compute the accessible description by concatenating the text alternatives for elements referenced by an aria-describedby attribute on the current element. The text alternatives for the referenced elements are computed using a number of methods, outlined below in the section titled Accessible Name and Description Computation.

`

``

215

`+

The following table provides the order of precedence for markup that can be applied to compute an accessible description. User agents MUST use the first applicable entry from the table where the listed conditions are met, as described in the last column. The user agent MUST NOT use any markup other that the first relevant markup found, even if that markup results in an empty description:

`

``

216

`+

`

``

217

`+

`

``

218

`+

`

``

219

`+

`

``

220

`+

`

``

221

`+

`

``

222

`+

`

``

223

`+

`

``

224

`+

`

``

225

`+

`

``

226

`+

`

``

227

`+

`

``

228

`+

`

``

229

`+

`

``

230

`+

`

``

231

`+

`

``

232

`+

`

``

233

`+

`

``

234

`+

`

``

235

`+

`

``

236

`+

`

``

237

`+

`

``

238

`+

`

``

239

`+

`

``

240

`+

`

``

241

`+

`

``

246

`+

`

``

249

`+

`

``

250

`+

`

``

251

`+

`

``

252

`+

`

``

253

`+

`

``

259

`+

`

``

260

`+

`

``

261

`+

`

``

262

`+

Precedence Attribute Applicable conditions How used to compute description
1 aria-describedby attribute Use on any element Text content computation on all nodes referenced by aria-describedby on the element, concatenated, and separated by a space character
2 aria-description attribute Use on any element As a flat string
3 host language features which participate in the description calculation

`

``

242

`+

Unique host language features MAY participate in the description computation for an element, only if they were not already used

`

``

243

`+

for the accessible name of the applicable element. See HTML AAM: Accessible Description Computation

`

``

244

`+

for the HTML elements which meet this condition.

`

``

245

`+

`

``

247

`+

Either a text equivalent computation of the element, or as a flat string of the attribute's value.

`

``

248

`+

4 host language tooltip attribute or equivalent feature (e.g., HTML title attribute)

`

``

254

`+

    `

    ``

    255

    `+

  • Any element
  • `

    ``

    256

    `+

  • Only use if not already used for the accessible name of this node
  • `

    ``

    257

    `+

`

``

258

`+

As a flat string

`

215

263

`

`

216

264

`

`

217

``

`-

Accessible Name and Description Computation

`

218

``

`-

The accessible name and description computation is used to generate both the accessible name and accessible description. There are different rules provided for several different types of [=element|elements=], [=nodes=], and combinations of markup. Text alternatives are built up, when appropriate, from all the relevant content contained within an [=element=]. This is accomplished via steps 2B and 2F, which are recursive, using the full set of rules to retrieve text from its own children or nodes it references.

`

``

265

`+

Text Equivalent Computation

`

``

266

`+

The text equivalent computation is used by both the accessible name and accessible description. There are different rules provided for several different types of [=element|elements=], [=nodes=], and combinations of markup. Text alternatives are built up, when appropriate, from all the relevant content contained within an [=element=]. This is accomplished via steps 2B and 2F, which are recursive, using the full set of rules to retrieve text from its own children or nodes it references.

`

219

267

`

The purpose of the computation is to create a perceivable label or description for alternative presentations, in the form of a flat string of space separated textual tokens.

`

220

268

`

`

221

269

`

Terminology

`

`@@ -308,8 +356,7 @@

Computation steps

`

308

356

`

`

309

357

`

  • Otherwise:
  • `

    310

    358

    `

      `

      311

      ``

      `-

    • if computing a name, and the current node has an aria-labelledby [=attribute=] that contains at least one valid IDREF, and the current node is not already part of an aria-labelledby traversal, process its IDREFs in the order they occur:
    • `

      312

      ``

      `-

    • or, if computing a description, and the current node has an aria-describedby [=attribute=] that contains at least one valid IDREF, and the current node is not already part of an aria-describedby traversal, process its IDREFs in the order they occur:

      `

      ``

      359

      `+

    • if the current node has an aria-labelledby [=attribute=] that contains at least one valid IDREF, and the current node is not already part of an ongoing aria-labelledby or aria-describedby traversal, process its IDREFs in the order they occur:
    • `

      313

      360

      `

        `

        314

        361

        `

      1. Set the accumulated text to the empty string.
      2. `

        315

        362

        `

      3. For each IDREF:
      4. `

        `@@ -357,7 +404,7 @@

        Computation steps

        `

        357

        404

        `

        <div role="checkbox" aria-checked="false">Flash the screen <span role="textbox" aria-multiline="false"> 5 </span> times</div>

        `

        358

        405

        `

        `

        359

        406

        `

        `

        360

        ``

        `-

      5. Otherwise, if computing a name, and if the current node has an aria-label [=attribute=] whose value is not undefined, not the empty string, nor, when trimmed of [=ascii whitespace|whitespace=], is not the empty string:

        `

        ``

        407

        `+

      6. Otherwise, if the current node has an aria-label [=attribute=] whose value is not undefined, not the empty string, nor, when trimmed of [=ascii whitespace|whitespace=], is not the empty string:

        `

        361

        408

        `

          `

          362

          409

          `

        • If traversal of the current node is due to recursion and the current node is an embedded control as defined in step 2C, ignore aria-label and skip to rule 2C.
        • `

          363

          410

          `

        • Otherwise, return the value of aria-label.
        • `