-
Notifications
You must be signed in to change notification settings - Fork 141
Description
There is a semantic aspect of aria-describedby which I think may get lost with the current spec copy, or perhaps I misunderstand something. Here are a couple of rather common use cases by way of illustration:
- A notifications button on a social media site which includes an additional 'badge' displaying the number of unread posts.
- A shopping cart on an e-commerce site which includes an additional 'badge' displaying the number of items in the cart.
- A process queue of items in a dashboard whose completion state is indicated with a small icon: Pending, processing, done.
These cases seem semantically identical.
I assume that the most correct way to associate the item count 'badge' or the process state icon with the element is to point to the id of the badge/icon with aria-describedby - is that right?
If so, I am concerned that the spec for aria-describedby states
The aria-labelledby attribute is similar to the aria-describedby in that both reference other elements to calculate a text alternative, but a label should be concise, where a description is intended to provide more verbose information.
(Emphasis mine). What bothers me here is that the item count in both the cases mentioned above is just a single value, and is certainly concise, rather than verbose. Strictly speaking, it's state, pure and simple. The current wording might lead authors to look beyond these attributes for expressing state values, or to 'hack' the accessible name to include this additional (and semantically distinct) text.
I strongly believe that concatenating an accessible name with semantically distinct strings that express state is an anti-pattern which indicates that a role or relationship may be missing. Similarly, it's preferred to rely on aria-pressed to express the state of a toggle button, rather than manipulating the accessible name.
I suppose that what is intended by the words "concise" and "verbose" is that aria-describedby calls for 'flat' strings (i.e. without further semantic variation).
The point appears to be to distinguish this attribute from aria-details which can point to rich text ("verbose"). Yet aria-details is not mentioned as a possible alternative in the spec for aria-describedby, in the useful way that certain other parts of the spec guide authors to make the other appropriate choices where there may be similarities in the semantics.
The distinction is made in the ARIA annotations spec. I approve of this clarity, and hope the distinction will be included in the 1.3 spec for aria-describedby.
So there are two problems here, one is to guide readers of the ARIA spec to make the correct choice between aria-labelledby, aria-describedby and aria-details based not on the razor of verbose/concise but on whether the indicated element is
- The accessible name of the element (
aria-labelledby) - A flat string describing the element (
aria-describedby) - A rich text structure describing the element (
aria-details)
... and secondly, to make it fully legitimate that concise 'state' annotations (such as the item counts or process state in the examples above) are valid use cases for aria-describedby - and I don't think that APG examples will be quite enough to make this unambiguous.
Or maybe I've got this all wrong, and someone could clear up my doubt about this. Is aria-describedby the wrong thing for arbitrary 'state' information associated with an element? Do we need something else?