Skip to content

Commit 1e400d9

Browse files
patrickarltDiogoMCampos
authored andcommitted
A11y fixes from Leaflet#3210 (Leaflet#5092)
1 parent c2ece0f commit 1e400d9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/control/Control.Zoom.js

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ L.Control.Zoom = L.Control.extend({
7979
link.href = '#';
8080
link.title = title;
8181

82+
/*
83+
* Will force screen readers like VoiceOver to read this as "Zoom in - button"
84+
*/
85+
link.setAttribute('role', 'button');
86+
link.setAttribute('aria-label', title);
87+
8288
L.DomEvent
8389
.on(link, 'mousedown dblclick', L.DomEvent.stopPropagation)
8490
.on(link, 'click', L.DomEvent.stop)

src/layer/tile/TileLayer.js

+6
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ L.TileLayer = L.GridLayer.extend({
140140
*/
141141
tile.alt = '';
142142

143+
/*
144+
Set role="presentation" to force screen readers to ignore this
145+
https://www.w3.org/TR/wai-aria/roles#textalternativecomputation
146+
*/
147+
tile.setAttribute('role', 'presentation');
148+
143149
tile.src = this.getTileUrl(coords);
144150

145151
return tile;

0 commit comments

Comments
 (0)