Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[accessibility] Make the map container a distinct semantic structure that entails all its components #11038

Open
Malvoz opened this issue Sep 18, 2021 · 2 comments

Comments

@Malvoz
Copy link

Malvoz commented Sep 18, 2021

When visual users look at a map they can easily tell that the controls, attribution, and other (potentially custom) UI components that are placed on the map belong to it. AT users rely on HTML semantics, DOM structure, and ARIA to convey these things and their relationships.

Currently, the tabindex="0", aria-label="Map" and role="region" (which together convey the focusable "map component") are set on the <canvas> which means that any components that are placed outside of it (e.g. the mapboxgl-control-container controls and potential custom UI components) aren't programmatically determinable as related to the map's structure.

Notice how in the accessibility tree the button is seemingly not part of any particular semantic structure:

mapbox-structure-current

If tabindex="0", aria-label="Map" and role="region" were moved from <canvas> to <div class="mapboxgl-map"> the correct structure would be accomplished (and logical focus order guaranteed). However, in this case I suppose the div would have to act as a proxy for canvas in terms of user input, and probably other things, which might get messy.

Another option is to use aria-owns which is seemingly widely supported, straight forward to use, and produces the desired result:

mapbox-structure-aria-owns

Although, the number 1 rule of using ARIA is to avoid using ARIA if you can. And there's also the consideration of how aria-owns should work with developers' custom UI components.


Relates to WCAG 2.1 SC 1.3.1 Info and Relationships.

@lpizzinidev
Copy link
Contributor

Hi @mourner ✋ can I work on this issue?

@mourner
Copy link
Member

mourner commented Nov 19, 2021

@lpizzinidev sure! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants