Consider not using default text in `alt` and `title`
From discussion in PR https://github.com/Leaflet/Leaflet/pull/8251#discussion_r881053782:
We should consider not using default titles.
Relatedly, I've been thinking of partially reverting https://github.com/Leaflet/Leaflet/pull/7895 to remove the default
alt="Marker", for several reasons (passing accessibility audits by default doesn't encourage unique titles, localization, inconsistent names depending on iftitleoralt/descwas used).
Should we revert the "Marker" alt to empty string? I believe so.
Pro's of "Marker" as default:
- ✔️ Each marker has an accessible name (such that screen reader users can know this is a marker)
Con's of "Marker" as default:
- ❌ Passing accessibility audits for (marker)
role="button"by default doesn't encourage unique and descriptivealt/title(as encouraged by our guideline for accessible markers) - ❌ Inconsistent names depending on if
titleoraltwas used:- If a developer only sets the
titleto e.g. "Kyiv", a screen reader would announce "Button, marker, Kyiv" - If a developer only sets the
altto e.g. "Kyiv", a screen reader would announce "Button, Kyiv"
- If a developer only sets the
- ❌ Localization/translation: If developers don't change the current default, they may unintentionally have mixed languages in their documents (although this is also true for other things such as
aria-labels in zoom controls etc. Related: https://github.com/Leaflet/Leaflet/issues/9092)
Additional consideration
If we revert the "Marker" alt, we should also consider removing the default titles "Circle", "Circle marker", "Polyline", "Polygon", "Rectangle" for vectors in https://github.com/Leaflet/Leaflet/pull/8251#discussion_r881053782. Can be adressed separately.
Source: Leaflet/Leaflet