Description
A developer reached out to me some weeks ago, and wrote I found you through your contributions to Leaflet and Maps4HTML
, I'm trying to decide on an open-source map library and one of my priorities is accessibility
, Would you be willing to provide some advice regarding the state of accessibility with these mapping libraries?
.
Not only do all of the libraries fail to implement a basic UI in an accessible manner (i.e. #247), but panning and zooming is for the most part meaningless to non-visual users.
Can pan and zoom (and map navigation as a whole) be made useful and meaningful, to everyone?
The problems
-
Panning & zooming is not meaningful to users of assistive technology
- There is no feedback provided to the user during/after pan and zoom, so these actions have no meaning to a non-visual user.
- Panning and zooming has (mostly) no effect on the visibility/focusability of elements, which leads to the next problem:
-
Navigating only features of interest
- It's not possible to only navigate features currently in view (whether "currently in view" is limited to a square in the center of the map or the visible content of the map viewer itself). Currently, if only 1 out of 100 focusable elements are in view there are still 100 elements in the tab order.
Potential solution(s)
(These solution parts are highly inspired by the Google Maps site's "Accessibility Mode" and Esri's a11y-map, and rely on role=application
such that screen reader users can pan using arrow keys as well).
-
The direction in which the user is panning should be announced
- Example: pressing → should announce
Moving East
(although cardinal directions are not relevant in drawings or schematics without geographic coordinates). - Why? This would allow non-visual users to learn in which direction a feature is located in relation to others.
- How? A (potentially sr-only) ARIA Live Region element (e.g.
role="status"
witharia-atomic="true"
):
<output role="status" aria-live="polite" aria-atomic="true" class="mapml-screen-reader"> Moving <span>East</span>. </output> <!-- <output> is implicitly role="status" in supporting browsers. It's recommended to explicitly set the role to bridge the gaps: https://www.scottohara.me/blog/2019/07/10/the-output-element.html#bridging-gaps -->
- Example: pressing → should announce
-
The zoom level should be announced (Announce zoom #664)
- Example: pressing + (or Enter/Space when the Zoom In control has focus) should announce e.g.
Zoom level 10
. - Why? This would allow non-visual users to learn how much to zoom in/out to reach a certain feature (but also the initial zoom level).
- How? A (potentially sr-only) ARIA Live Region element:
<output role="status" aria-live="polite" aria-atomic="true" class="mapml-screen-reader"> Zoom level: <span>10</span>. </output>
- Example: pressing + (or Enter/Space when the Zoom In control has focus) should announce e.g.
-
Min/max zoom & pan should be announced when reached
- Example: pressing - (or Enter/Space when the Zoom Out control has focus) and reaching the minimum zoom level should announce e.g.
Minimum zoom level reached: zoom out disabled
. - Why? This would allow non-visual users to learn that they've reached the min/max zoom level and/or bounds of the map.
- How? A (potentially sr-only) Live Region element:
<output role="status" aria-live="polite" aria-atomic="true" class="mapml-screen-reader"> <span>Minimum</span> zoom level reached: zoom <span>out</span> disabled. </output> <output role="status" aria-live="polite" aria-atomic="true" class="mapml-screen-reader"> Map bound to <span>East</span> has been reached: panning <span>East</span> disabled. </output>
- Example: pressing - (or Enter/Space when the Zoom Out control has focus) and reaching the minimum zoom level should announce e.g.
-
Features out of view should be hidden
(proposed capability: Capability: Hide or show content outside the map display HTML-Map-Element-UseCases-Requirements#239)- Why? They aren't relevant to the user.
- How? Set elements out of view as
inert
.
-
Features in view should be announced
- Example: There are 2 features on a map, labelled "Feature A" (in view) and "Feature B" (out of view), "Feature A" should be announced on initial load of the map, after panning Feature B into view "Feature B" should be announced.
- Why? This would allow non-visual users to know which features are currently available.
- How? Screen readers announce content that is visible by default, on page load & when the user focuses the map viewer (in the example, "Feature A" is currently announced correctly). But screen readers don't announce content that has its visibility (e.g.
inert
attribute) toggled. To have features announced as they become visible on pan/zoom I believe either of the following would be required:- a) All features be part of a Live Region element(s) and trigger a change as needed for screen readers to react to Live Regions, this would probably introduce other issues. Or
- b) Each feature name (derived from
<featurecaption>
(<g aria-label="">
)) added to a Feature Index (Feature Index #397) Live Region element (it could be sr-only by default, and a control could be provided to toggle between "screen reader only" and "visible to all").
Related comments/issues:
- Adding tabbing navigation and accessibility to map #270 (comment) + Adding tabbing navigation and accessibility to map #270 (comment)
- Assign tabindex=n in ascending order of distance of feature from map centre #385
- Feature tab order experiments#2
Related experiments: