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

<g> element <path> children's <title> values are not read #332

Closed
prushforth opened this issue Mar 2, 2021 · 4 comments
Closed

<g> element <path> children's <title> values are not read #332

prushforth opened this issue Mar 2, 2021 · 4 comments

Comments

@prushforth
Copy link
Member

Leaflet renders vector info as SVG <path>s, which it groups into a single <g> element. Each feature you create is rendered as a path inside that <g>, and we have successfully added a <title> to each one, anticipating that it might be read by screen readers.

While the "g" is announced (on chrome, "blank" on FireFox) for each <path> inside the <g>, the path's <title> value doesn't get read. If I remove the <g> in devtools (re-parenting the <path>s to be children of <svg>) , both "g" and the <title> value are announced (using NVDA in Chrome. I tried that trick with FireFox but the tab crashed). Is there some way to convince screen readers to look inside a group for path titles ?

I think @shepazu may have already written the answer to this in blog post form: <path aria-label="accessible name"...> attribute instead of (as well as??) <path><title>

cc @Malvoz

@prushforth
Copy link
Member Author

Update: aria-label seems to work in Chrome but not in FireFox (with NVDA) .

@prushforth prushforth transferred this issue from Maps4HTML/experiments Mar 2, 2021
@prushforth
Copy link
Member Author

I think the reason that there were issues with the <title> element was because it was being created with document.createElement. So I believe this PR fixes the screen reader issue.

@prushforth
Copy link
Member Author

prushforth commented Mar 2, 2021

While the PR did fix the screen reader issue, mostly, it didn't fix it for the first path in the group; at least, you have to tab past the first path and then shift-tab to it, and then it is read. But it's better than it was. If you have an idea about how to solve this latter problem, please comment. I'll close this issue for the time being.

Of note is that this latter problem exists in both Chrome and Firefox.

@Malvoz
Copy link
Member

Malvoz commented Mar 3, 2021

for the first path in the group; at least, you have to tab past the first path and then shift-tab to it, and then it is read.

Screen readers seem to have problems with nested interactive elements (map features are nested interactive elements inside leaflet-container which has tabindex="0"). I don't think there are many (if any) interactive elements except for <summary> that allow interactive content as descendants per the HTML spec so that's probably why screen readers don't handle it well. If tabindex="0" is removed from leaflet-container the first path in the group is announced correctly.

If role="application" (#274) is applied to <mapml-viewer> the first path in the group is announced correctly.

Setting aria-live="polite" on the tooltip can be used to tell screen readers to announce the content as it pops up on hover/focus, but I think that'll ultimately end up with screen readers announcing both <path><title> and the tooltip (on focus). And because they're identical that could be pretty annoying.

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

No branches or pull requests

2 participants