-
Notifications
You must be signed in to change notification settings - Fork 342
Invalid <label> tags in quick links menu #1287
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
Comments
The class I also think that this is not a proscribed use of the
...so it's not just limited to form elements IIUC. Feel free to re-open if you think I'm mistaken or misinterpreting. |
I do think you are misinterpreting. The examples you show are all for input elements, and the html standard referenced also only uses it in the context of forms. In addition, the w3school page lists the elements for which it is valid, and last, but not least, the w3 validator explicitly states it's an error to use it in this way: I cannot re-open the issue, only comment on it. |
As for accessibility aspect, I think the correct solution is to add an aria-label attribute to the anchor tag instead. I ran my website through an accessibility tool, and those label tags were listed as orphaned labels, so the tool didn't seem to know what they were for, which defeats the entire purpose. |
thanks for the thorough explanation. Indeed it seems I was misunderstanding the MDN page (because I didn't read it carefully enough, which I now have). Sorry about that. Please go ahead with the PR fix! |
Chiming in here to add more context from an accessibility POV in case @vkbo finds it useful for the PR Indeed <a {{ attributeString }}>
{%- if type == "fontawesome" -%}
<span><i class="{{ icon }}" aria-hidden="true"></i></span>
<span class="sr-only">{{ name }}</span>
...
</a> Where:
Some references: |
Thanks! I'll make the PR this weekend. I'm a bit overloaded at work at the moment. But as I understand it then, there's no need for the |
Correct that way the link remains focusable and visible for screen readers (and not the icon itself). |
Inside the anchor tag in the list elements that make up the quick links menu, there is a label tag after the span that loads the fontawesome icon. I'm not sure why those label tags were added, but this is an incorrect use of label tags. They are intended for use with form input elements, not in anchor tags.
I'm happy to submit a fix, but I was wondering what the reason for them were first. They were added in #293.
pydata-sphinx-theme/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html
Lines 13 to 24 in a55cb93
The text was updated successfully, but these errors were encountered: