themes: Don't duplicate "navigation" in aria-label (#12422)

The word "navigation" is not supposed to be included as part of the aria-label attribute:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/navigation_role
This commit is contained in:
Thomas Weißschuh 2024-06-17 12:50:34 +02:00 committed by GitHub
parent 1e297bb8c5
commit d5bdabdd80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 13 deletions

View File

@ -18,7 +18,7 @@
{% endblock %} {% endblock %}
{%- block relbar1 %} {%- block relbar1 %}
<div class="related" role="navigation" aria-label="related navigation"> <div class="related" role="navigation" aria-label="Related">
<h3>{{ _('Navigation') }}</h3> <h3>{{ _('Navigation') }}</h3>
<ul> <ul>
<li><a href="{{ pathto(root_doc)|e }}">Documentation</a> &raquo;</li> <li><a href="{{ pathto(root_doc)|e }}">Documentation</a> &raquo;</li>
@ -32,7 +32,7 @@
{%- block content %} {%- block content %}
<div class="document"> <div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="Main">
{%- include "searchfield.html" %} {%- include "searchfield.html" %}
<div class="sphinxsidebar-navigation__contents"> <div class="sphinxsidebar-navigation__contents">
<h3>{{ _('On this page') }}</h3> <h3>{{ _('On this page') }}</h3>

View File

@ -22,7 +22,7 @@
<div class="headertitle"><a <div class="headertitle"><a
href="{{ pathto(root_doc)|e }}">{{ shorttitle|e }}</a></div> href="{{ pathto(root_doc)|e }}">{{ shorttitle|e }}</a></div>
{%- endblock %} {%- endblock %}
<div class="rel" role="navigation" aria-label="related navigation"> <div class="rel" role="navigation" aria-label="Related">
{%- for rellink in rellinks|reverse %} {%- for rellink in rellinks|reverse %}
<a href="{{ pathto(rellink[0])|e }}" title="{{ rellink[1]|striptags|e }}" <a href="{{ pathto(rellink[0])|e }}" title="{{ rellink[1]|striptags|e }}"
{{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
@ -76,7 +76,7 @@
<div class="footer-wrapper"> <div class="footer-wrapper">
<div class="footer"> <div class="footer">
<div class="left"> <div class="left">
<div role="navigation" aria-label="related navigation"> <div role="navigation" aria-label="Related">
{%- for rellink in rellinks|reverse %} {%- for rellink in rellinks|reverse %}
<a href="{{ pathto(rellink[0])|e }}" title="{{ rellink[1]|striptags|e }}" <a href="{{ pathto(rellink[0])|e }}" title="{{ rellink[1]|striptags|e }}"
{{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>

View File

@ -22,7 +22,7 @@
{%- endif %} {%- endif %}
{%- macro relbar() %} {%- macro relbar() %}
<div class="related" role="navigation" aria-label="related navigation"> <div class="related" role="navigation" aria-label="Related">
<h3>{{ _('Navigation') }}</h3> <h3>{{ _('Navigation') }}</h3>
<ul> <ul>
{%- for rellink in rellinks %} {%- for rellink in rellinks %}
@ -45,7 +45,7 @@
{%- macro sidebar() %} {%- macro sidebar() %}
{%- if render_sidebar %} {%- if render_sidebar %}
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
{%- block sidebarlogo %} {%- block sidebarlogo %}
{%- if logo_url %} {%- if logo_url %}

View File

@ -48,7 +48,7 @@
{%- endif %} {%- endif %}
{%- endblock %} {%- endblock %}
</div> </div>
<div class="topnav" role="navigation" aria-label="top navigation"> <div class="topnav" role="navigation" aria-label="Top">
{{ nav() }} {{ nav() }}
</div> </div>
<div class="content" role="main"> <div class="content" role="main">
@ -60,7 +60,7 @@
{%- endif %}#} {%- endif %}#}
{% block body %}{% endblock %} {% block body %}{% endblock %}
</div> </div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation"> <div class="bottomnav" role="navigation" aria-label="Bottom">
{{ nav() }} {{ nav() }}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -26,7 +26,7 @@
<h1 class="heading"><a href="{{ pathto(root_doc)|e }}" <h1 class="heading"><a href="{{ pathto(root_doc)|e }}"
title="back to the documentation overview"><span>{{ title|striptags|e }}</span></a></h1> title="back to the documentation overview"><span>{{ title|striptags|e }}</span></a></h1>
</div> </div>
<div class="relnav" role="navigation" aria-label="related navigation"> <div class="relnav" role="navigation" aria-label="Related">
{%- if prev %} {%- if prev %}
<a href="{{ prev.link|e }}">&laquo; {{ prev.title }}</a> | <a href="{{ prev.link|e }}">&laquo; {{ prev.title }}</a> |
{%- endif %} {%- endif %}
@ -37,7 +37,7 @@
</div> </div>
<div id="contentwrapper"> <div id="contentwrapper">
{%- if display_toc %} {%- if display_toc %}
<div id="toc" role="navigation" aria-label="table of contents navigation"> <div id="toc" role="navigation" aria-label="Table of contents">
<h3>{{ _('Table of Contents') }}</h3> <h3>{{ _('Table of Contents') }}</h3>
{{ toc }} {{ toc }}
</div> </div>

View File

@ -222,7 +222,7 @@ def test_html_sidebar(app, status, warning):
app.build(force_all=True) app.build(force_all=True)
result = (app.outdir / 'index.html').read_text(encoding='utf8') result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert ('<div class="sphinxsidebar" role="navigation" ' assert ('<div class="sphinxsidebar" role="navigation" '
'aria-label="main navigation">' in result) 'aria-label="Main">' in result)
assert '<h1 class="logo"><a href="#">Python</a></h1>' in result assert '<h1 class="logo"><a href="#">Python</a></h1>' in result
assert '<h3>Navigation</h3>' in result assert '<h3>Navigation</h3>' in result
assert '<h3>Related Topics</h3>' in result assert '<h3>Related Topics</h3>' in result
@ -237,7 +237,7 @@ def test_html_sidebar(app, status, warning):
app.build(force_all=True) app.build(force_all=True)
result = (app.outdir / 'index.html').read_text(encoding='utf8') result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert ('<div class="sphinxsidebar" role="navigation" ' assert ('<div class="sphinxsidebar" role="navigation" '
'aria-label="main navigation">' in result) 'aria-label="Main">' in result)
assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result
assert '<h3>Navigation</h3>' not in result assert '<h3>Navigation</h3>' not in result
assert '<h3>Related Topics</h3>' in result assert '<h3>Related Topics</h3>' in result
@ -251,7 +251,7 @@ def test_html_sidebar(app, status, warning):
app.build(force_all=True) app.build(force_all=True)
result = (app.outdir / 'index.html').read_text(encoding='utf8') result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert ('<div class="sphinxsidebar" role="navigation" ' assert ('<div class="sphinxsidebar" role="navigation" '
'aria-label="main navigation">' not in result) 'aria-label="Main">' not in result)
assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result
assert '<h3>Navigation</h3>' not in result assert '<h3>Navigation</h3>' not in result
assert '<h3>Related Topics</h3>' not in result assert '<h3>Related Topics</h3>' not in result