Skip to content

Way of providing accessible name/description as an HTML element #7326

@domenic

Description

@domenic

Spinning off from some discussion early in #5811, and also relevant to some of the comments on sectioning content vs. not in #7320. /cc @whatwg/a11y

My understanding of the problem: several "section-ish" HTML elements, like section, article, aside, nav, dialog, and #7320's search, get their accessible name or description via this algorithm, which requires either using aria-describedby=""/aria-label=""/aria-labelledby="" attributes, or the HTML title="" attribute.

In general, we want to encourage people to write accessible HTML without needing to rely on ARIA, and would like to co-evolve HTML in a way to improve the situation.

title="" as the current non-ARIA way of providing such accessible names or descriptions is not great, for a couple of reasons:

  • In many browsers, it will cause a tooltip to pop up on mouse hover. It's possible (perhaps likely) that a web developer might want a specific tooltip, but would not want to use the contents of the tooltip as an accessible name/description. Conversely, it's possible (perhaps likely) that a web developer might want a given accessible name/description, but not to cause a tooltip with that value.

  • It only accepts strings, not HTML. This means it loses important capabilities like supscripts/superscripts, ruby, language and directionality markup, etc. /cc @whatwg/i18n who have brought up this sort of thing a good deal in the past.

This issue is about whether we should consider adding new HTML element(s), or repurposing existing HTML element(s), to help with such accessible name/description computation.

Foundational questions I have about this project:

  • Is my understanding of the problem statement accurate?
  • How much of a problem is this, in practice? Are accessible names/descriptions for these "section-ish" HTML elements something that authors should generally provide, or are they only in the accessible name/description computation algorithm for exceptional circumstances?
  • Do these considerations apply equally to all the elements I listed (section, article, aside, nav, dialog, and search)? Are there others I missed?
  • How does accessible name/description interact with the <hN> elements? My vague understanding is that the hNs only contribute to heading-based navigation in most accessibility tech; I can't find any evidence in HTML-AAM or elsewhere that they interact with accessible name/description computation. Is that separation good, or bad? Naively I'd imagine that if you do <section><h3>Section title</h3>...</section>, "Section title" would make a pretty good accessible name...

Some more-detailed questions that might guide a possible proposal; probably not worth answering until we get the above straightened out:

  • Do we want to provide methods for setting both the accessible description and accessible name, or just one?
  • Relatedly, the HTML-AAM algorithm for processing title="" first tries to use it as accessible name, then falls back to using it as the accessible description if an aria-label=""/aria-labelledby="" attribute "claimed" the accessible name value. Is that the kind of semantic we might want here, i.e. this new element is name-first but can be used as a description if ARIA claimed the name? It seems a bit strange, but maybe it works out in practice...
  • Should <hN> elements be involved at all? E.g. maybe <hN name> instead of a new element?
  • If we reuse an existing element, there are lots of candidates: <legend>, <summary>, <caption>; perhaps even <title> or <label>, although probably not. We should probably figure out why in the past we introduced new elements for <summary> and <figcaption> instead of reusing <legend> or <caption>, as that might give us some guidance on the general principles of reuse vs. new element(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    a11y-trackerGroup bringing to attention of a11y, or tracked by the a11y Group but not needing response.accessibilityAffects accessibility

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions