leaflet-gps
leaflet-gps copied to clipboard
[accessibility] Make the gps-alert available to screen readers
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.
Other potentially helpful resources: