Skip to content

Commit

Permalink
DP-31798: A11y: Hide the map from keyboard and AT users (#1881)
Browse files Browse the repository at this point in the history
* DP-31798: A11y: Hide the map from keyboard and AT users

* DP-31798: A11y: Hide the map from keyboard and AT users

* Add skip link

* style skip link and its target

---------

Co-authored-by: Yukiko Gannett <yukikogannett@gmail.com>
  • Loading branch information
arthurbaghdas and ygannett authored Mar 4, 2024
1 parent 4e9a154 commit 347ef02
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelogs/DP-31798.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Changed:
- project: Patternlab
component: MappedLocations
description: A11y - Hide the map from keyboard and AT users. (#1881)
issue: DP-31798
impact: Patch
16 changes: 16 additions & 0 deletions packages/assets/scss/03-organisms/_mapped-locations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@
height: 500px;
}
}

// skip link

@include ma-skip-link;

&__skip-link {
// override mixin to take advantage of flexbox on map.
margin-top: 0;
float: none;

flex: 0 1 auto;
}

&__skip-link_target {
flex: 0 1 auto;
}
}

&__aside {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@
</div>
{% endif %}
{% if mappedLocations.leafletMap %}
<div class="ma__mapped-locations__map">
<div class="ma__mapped-locations__map" aria-hidden="true">
{% set id = 'dataviz-' ~ random(9999) %}
<a class="ma__mapped-locations__map__skip-link js-skiplink" href="#map_{{ id }}">Skip this map.</a>
{% set leafletMap = mappedLocations.leafletMap %}
{% include "@molecules/map-leaflet.twig" %}
<div class="ma__mapped-locations__map__skip-link_target js-skiplink-target">
<a id="map_{{ id }}" tabindex="-1">You skipped the map.</a>
</div>
</div>
{% endif %}
</section>

0 comments on commit 347ef02

Please sign in to comment.