#8267·Leaflet

Consider not using default text in `alt` and `title`

Author: MalvozCreated May 25, 2022Updated Jun 24, 2026
Labelsgood first issueaccessibilityneeds decision

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 if title or alt/desc was used).

Should we revert the "Marker" alt to empty string? I believe so.

https://github.com/Leaflet/Leaflet/blob/93f681c488ec07690cd4a393056078cf88f3bcff/src/layer/marker/Marker.js#L46-L49

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 descriptive alt/title (as encouraged by our guideline for accessible markers)
  • ❌ Inconsistent names depending on if title or alt was used:
    • If a developer only sets the title to e.g. "Kyiv", a screen reader would announce "Button, marker, Kyiv"
    • If a developer only sets the alt to e.g. "Kyiv", a screen reader would announce "Button, Kyiv"
  • ❌ 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.