Skip to content

HTML-AAM - test and update name calc for labelable elements #29

Open

Description

@jasonkiss

From @stevefaulkner on February 20, 2016 8:36

test the following elements (where label not already included in name calc) and update where necessary to reflect implementations.

list of labelable elements in HTML5 includes
button input (if the type attribute is not in the hidden state)keygen meter output progress select textarea

http://www.w3.org/TR/html5/forms.html#category-label

Copied from original issue: w3c/aria#259

Activity

  1. jasonkiss commented on Oct 12, 2016

    @jasonkiss
    ContributorAuthor
  2. added this to the milestone on Jun 17, 2017
  3. jasonkiss commented on Feb 27, 2018

    @jasonkiss
    ContributorAuthor

    Here's an attempt to consolidate the accessible name computation for labelable elements (button, input (if the type attribute is not in the Hidden state), meter, output, progress, select, and textarea).

    I think the following computation covers all labelable elements, but I'm not certain it is easier to understand than the current or some other approach. What do you think @stevefaulkner @asurkov @boggydigital ?

    1. Use aria-label or aria-labelledby
    2. Otherwise, use associated label element(s)
    3. Otherwise,
    • if input@type="image",
      i. use alt attribute
      ii. otherwise, use value attribute
      iii. otherwise, MAY use localized version of string "submit"

    • if input@type="button|reset|submit",
      i. use value attribute
      ii. otherwise, MUST use localized version of string "reset" if type="reset", and localized version of string "submit" if type="submit"

    • if button, meter, output, or progress, use the element's subtree

    1. Otherwise, use title attribute
    2. Otherwise, no accessible name

    Note that the accessible description computations for these elements can easily be similarly consolidated.

    Here are the four individual computation groups or sequences consolidated above. Perhaps I've got one or more of these wrong. In particular, I'm assuming that the value attribute is not a good option for accessible name with the meter and progress elements.

    Group A

    For the following elements:

    • input@type="text"
    • input@type="search"
    • input@type="tel"
    • input@type="url"
    • input@type="email"
    • input@type="password"
    • input@type="date"
    • input@type="month"
    • input@type="week"
    • input@type="time"
    • input@type="datetime-local"
    • input@type="number"
    • input@type="range"
    • input@type="color"
    • input@type="checkbox"
    • input@type="radio"
    • input@type="file"
    • textarea
    • select

    The accessible name is computed as follows:

    1. aria-label or `aria-labelledby'
    2. otherwise label
    3. otherwise title attribute
    4. otherwise no accessible name

    Group B

    For the following elements:

    • input@type="submit"
    • input@type="reset"
    • input@type="button"

    The accessible name is computed as follows:

    1. aria-label or `aria-labelledby'
    2. otherwise label
    3. otherwise value attribute
    4. otherwise localized version of string "reset" for type="reset" and localized version of string "submit" for type="submit"
    5. otherwise title attribute
    6. otherwise no accessible name

    Group C

    For the following element:

    • input@type="image"

    The accessible name is computed as follows:

    1. aria-label or `aria-labelledby'
    2. otherwise label
    3. otherwise alt attribute
    4. otherwise value attribute
    5. (optional) otherwise localized version of string "submit"
    6. otherwise title attribute
    7. otherwise no accessible name

    Group D

    For the following elements:

    • button
    • meter
    • output
    • progress

    The accessible name is computed as follows:

    1. aria-label or `aria-labelledby'
    2. otherwise label
    3. otherwise element's content subtree
    4. otherwise title attribute
    5. otherwise no accessible name
  4. jasonkiss commented on Mar 7, 2018

    @jasonkiss
    ContributorAuthor

    See https://rawgit.com/w3c/html-aam/jasonkiss-issue-29/#accessible-name-and-description-computation for a 'live' version of the changes I propose for the Acc Name and Desc section.

  5. asurkov commented on Mar 8, 2018

    @asurkov
    Contributor

    @jasonkiss I like it. Is there a diff I can run through and comment?

  6. stevefaulkner commented on Mar 8, 2018

    @stevefaulkner
    Contributor
  7. jasonkiss commented on Mar 8, 2018

    @jasonkiss
    ContributorAuthor
  8. asurkov commented on Mar 13, 2018

    @asurkov
    Contributor

    Thank you. I run through the diff and left comments here and there. Hope it makes sense.

  9. added
    accName & DescRelated to accessible name or description
    and removed on Jan 23, 2022
  10. scottaohara commented on Feb 7, 2025

    @scottaohara
    Member

    many other PRs are open to fill in the form elements that aren't listed
    there have been other updates since this issue was created that filled in other gaps.
    what we need is to remove the "other form elements" and just list out the remaining elements that aren't in the spec yet. may just be meter and progress, but we'll double check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

accName & DescRelated to accessible name or description

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions