Leaflet's map container element is focusable because it has a tabindex="0" attribute set. This enables keyboard users to, "... navigate the map with keyboard arrows and +/- keys."
Every interactive element should have an accessible name, role and value (and/or state). Without an accessible name and role, users of assistive technology will not understand what they can do when focused on the map container.
Set role and aria-label attributes on the container element. We can also set aria-roledescription (note, this needs translating/localizing, as does aria-label). For example:
Problem
Leaflet's map container element is focusable because it has a
tabindex="0"
attribute set. This enables keyboard users to, "... navigate the map with keyboard arrows and +/- keys."Every interactive element should have an accessible name, role and value (and/or state). Without an accessible name and role, users of assistive technology will not understand what they can do when focused on the map container.
Solution
Set
role
andaria-label
attributes on the container element. We can also setaria-roledescription
(note, this needs translating/localizing, as doesaria-label
). For example:Result: