leaflet-gps icon indicating copy to clipboard operation
leaflet-gps copied to clipboard

[accessibility] Make the gps-alert available to screen readers

Open Malvoz opened this issue 4 years ago • 1 comments

Making the .gps-alert a live region is important as it conveys to screen readers that the content should be announced when added to the DOM, or otherwise has been updated. This is done by adding the status role (a live region role) to the <div>, and accompanying ARIA attributes:

<div class="gps-alert" style="display: block;"
+ role="status"
+ aria-live="polite"
+ aria-atomic="true">
  Geolocation error: User denied Geolocation.
</div>

While role="status" already implies aria-live="polite", it's best to be explicit with the value per MDN advice:

To maximize compatibility, add a redundant aria-live="polite" when using this role.

Malvoz avatar Dec 01 '20 16:12 Malvoz