Consider allowing `aria-label` on `role="time"`
zcorpan opened this issue · 3 comments
The text content of an element with role="time"
(when not the time
element with a datetime
attribute) is a machine-readable time, which is often not what you want to present to humans. For example, in https://shkspr.mobi/blog/2020/12/making-time-more-accessible/ there's a desire to have "1 hour ago" as the text exposed to accessibility APIs (and "1h" for visual rendering). Prohibiting name for role=time
makes this unnecessarily difficult.
Originally posted by @zcorpan in #2075 (comment)
@scottaohara commented
Naming time may not be the best way forward here, so maybe something else closer to what abbr and the title attribute allow for should also be considered.
thank you @zcorpan
some additional context for my comment is that some people may want the "1h" text to be announced to them as "1 hour ago", while some others are perfectly fine with the "1h" as visually rendered.
the way the abbr element and the title attribute work with JAWS, for example, is that title doesn't just overwrite the text of the abbr as its name. But JAWS provides a setting so that someone can make the choice to hear the abbr as either what's presented visually, or replaced with the content of the title attribute. Being a user choice, this can then also mitigate any awkwardness for someone who might need to copy/paste a selection of text that includes an abbr (or in this case, a time element) - and upon pasting they find that the text that they heard is not matching what they pasted.
in summary, i like this idea of this proposal - i just am not sure aria-label is the way to go here. We have also talked about how there's a need for an 'alternate label' or 'terse label' in relation to other scenarios, like mitigating overly long captions, legends and column/row headers. This might be worth considering in those buckets as well, since there's no good way to even replicate what abbr title=...
allows with ARIA right now.
If an author chooses to expose machine-friendly language to sighted users, they should do the same for screen reader users.
Prohibiting naming of the element ensures that the actual content of the element is accessible to everyone. It is a design decision to show "1H ago" instead of "1 Hour Ago" to users.
Per discussion in August 29, 2024 ARIA working group telecon, closing this as won't fix.