From 00cceee9697c29b63b58d2f94b1ba8e795f7d615 Mon Sep 17 00:00:00 2001 From: Patrick Arlt Date: Fri, 11 Nov 2016 17:17:49 -0800 Subject: [PATCH] A11y fixes from #3210 (#5092) --- src/control/Control.Zoom.js | 6 ++++++ src/layer/tile/TileLayer.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/control/Control.Zoom.js b/src/control/Control.Zoom.js index e8a983ec3a0..0345d887570 100644 --- a/src/control/Control.Zoom.js +++ b/src/control/Control.Zoom.js @@ -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) diff --git a/src/layer/tile/TileLayer.js b/src/layer/tile/TileLayer.js index 3e29298923f..a3848092628 100644 --- a/src/layer/tile/TileLayer.js +++ b/src/layer/tile/TileLayer.js @@ -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;