-
Notifications
You must be signed in to change notification settings - Fork 146
Description
The <title> element allows for providing a 'short alternate text' for an element. Browsers will show this as a tooltip when hovering the cursor over the respective element, or, where used directly under an <svg> element, display it as a browser tab label or window title.
While the <title> element has a lang attribute, there seems to currently be no way of making <title> text depend upon system language, unlike <text> and <tspan>.
Use case example 1
I have an SVG diagram which includes some labels. To suit the diagram these labels have to be extremely short. For some of them it would be preferable to use a <title> to provide a slightly longer text variant which could be revealed upon hovering over the element, to aid with understanding. (Simply presenting longer labels in a smaller font would be far from ideal). This diagram though is multi-lingual, containing translations of all of the <text> labels via <switch> and systemLanguage. While translation works perfectly for the actual displayed labels, it seems to be impossible to translate such <title> tooltips (and the document title).
I tried using aria-label on the translated <text>/<tspan> elements as an alternative to using <title>, but neither Firefox nor Chrome display this as a tooltip.
I also tried using <switch> and <text>/<tspan> elements with systemLanguage under a <title> element in Firefox, but the tooltip just contained every translation, so it seems that use isn't supported (though I haven't double checked the spec).
Use case example 2
Such ability to translate <title> elements could be useful to the World Map SVG on wikipedia. This uses <title> elements such that when you hover over a country region a tooltip appears with the country name. As is though, only English names can be shown. If <title> translations were supported, it could display translated country names for different users. (Without having to create separate, translated copies of the file).