Open silverwind opened 1 year ago
We explored aria-label
in https://github.com/github/relative-time-element/pull/243 but it’s not the correct behaviour for this element, as it isn’t a focusable or otherwise interactive element. title
isn’t necessarily correct either but right now it seems to be the least worst way of handling this.
I’m hesitant to introduce an attribute to customise this for two reasons:
aria-label
which seems to be worse for accessibility (based on our testing) should not be possible.One particular use of non-title
tooltips is that they can allow the interactive selection of the value, which I find useful for referencing a date. Hover the time element, move mouse into tooltip, select and copy. Such interaction is not possible with title
.
Currently I've implemented this via a one-time attribute value swap at page load and a MutationObserver
to catch newly added elements, but it feels suboptimal.
Currently the element always sets the
title
attribute, but to implement a custom tooltip solution, it would be nice for it to set a different HTML attribute. How about a propertytitleAttribute="title"
, that could for example be set toaria-label
?