-
-
Notifications
You must be signed in to change notification settings - Fork 158
Fixes header-ids accessibility #574
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
Fixes header-ids accessibility #574
Conversation
Thank you very much! 🧡 |
My pleasure, I'll fix those tests. |
Accessibiity tools can't handle the anchors generated as they retain focus, adding the (inert)[https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/inert] prevents focus on this element and fixes this accessibility issue.
Head branch was pushed to by a user without write access
c29c3a3
to
75f19f6
Compare
@kivikakk sorry, automerge got disabled when I pushed the fix to the test. |
No problems :) thank you again!! |
@davemackintosh I'm a little confused by this change. Doesn't this make the header link unusable? From my testing there is no way to grab the link to that specific header. GitHub doesn't add header links in their issue description/comments, but they do in rendered files, like a But from my testing, Exactly which accessibility tools are having a problem? I do think there are some things that need to get done to make header accessibility better, but I'm not sure this one is correct. |
Thanks for bringing this to our attention, @digitalmoksha! I am not the target audience for screen readers (my accessibility needs run the "other" way; it's hearing I struggle with), so I will need to rely on your (pl.) experience and connection with users to determine the best solution. In the meantime, should we revert? |
It's my understanding that this prevents screen readers from incorrectly jumping about as clicking to the anchor gives the target focus and the inert property prevents the focus. I'm happy to be wrong about this though. |
The problem is indeed as @digitalmoksha describes it; the anchor is intended not only as a destination, but a clickable element which links to itself. This permits end-users to get an easy reference to that anchor. Here's an example as seen on GitHub: With Might it not be sufficient to set |
The Line 645 in 017a9d6
There was an idea about putting the text inside the link Change <h2 data-sourcepos="5:1-5:18" dir="auto">
Expected result
<a href="#expected-result" aria-hidden="true" class="anchor" id="user-content-expected-result">
</a>
</h2> to <h2 data-sourcepos="5:1-5:18" dir="auto">
<a href="#expected-result" class="anchor" id="user-content-expected-result">
Expected result
</a>
</h2> I don't know if that would fix it or not. I'm failing at really testing this out on my system. Another idea is was using <h2 data-sourcepos="5:1-5:18" dir="auto" id="user-content-expected-result-text">
<a href="#expected-result" aria-labelledby="user-content-expected-result-text" class="anchor" id="user-content-expected-result">
</a>
Expected result
</h2> |
I do think we will need to revert this while we find a better accessibility solution. |
hah. Good on me for checking first. I will revert. I think we need a clearer idea of what unpleasantness is being caused --- i.e. what actually is happening for screen reader users, as I'm still unclear on what the original issue describes ("can't handle the anchors [...] as they retain focus when you go to them"). Does it mean the reader doesn't continue automatically after following an anchor? (I am assuming this would be desirable.) I wonder if moving the |
This reverts commit 75f19f6. See discussion at #574 (comment).
In the meantime, you can add this snippet to your website to naively (enhance to your own desire to avoid false positives) remove the inert attribute document.querySelectorAll("a[inert]").forEach((node) => {
node.removeAttribute("inert");
}); |
@kivikakk I see you made the revert. Should we cut a new release? |
Indeed :) Done; v0.40.0 (!). |
Accessibiity tools can't handle the anchors generated as they retain focus, adding the inert prevents focus on this element and fixes this accessibility issue. Closes #573