Skip to content

Commit

Permalink
A11y fixes from Leaflet#3210 (Leaflet#5092)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickarlt authored and DiogoMCampos committed Dec 18, 2016
1 parent 1cbbd7a commit 00cceee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/control/Control.Zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ L.Control.Zoom = L.Control.extend({
link.href = '#';
link.title = title;

/*
* Will force screen readers like VoiceOver to read this as "Zoom in - button"
*/
link.setAttribute('role', 'button');
link.setAttribute('aria-label', title);

L.DomEvent
.on(link, 'mousedown dblclick', L.DomEvent.stopPropagation)
.on(link, 'click', L.DomEvent.stop)
Expand Down
6 changes: 6 additions & 0 deletions src/layer/tile/TileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ L.TileLayer = L.GridLayer.extend({
*/
tile.alt = '';

/*
Set role="presentation" to force screen readers to ignore this
https://www.w3.org/TR/wai-aria/roles#textalternativecomputation
*/
tile.setAttribute('role', 'presentation');

tile.src = this.getTileUrl(coords);

return tile;
Expand Down

0 comments on commit 00cceee

Please sign in to comment.