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

View File

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

View File

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

View File

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

View File

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

View File

@ -222,7 +222,7 @@ def test_html_sidebar(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'index.html').read_text(encoding='utf8')
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 '<h3>Navigation</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)
result = (app.outdir / 'index.html').read_text(encoding='utf8')
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 '<h3>Navigation</h3>' not 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)
result = (app.outdir / 'index.html').read_text(encoding='utf8')
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 '<h3>Navigation</h3>' not in result
assert '<h3>Related Topics</h3>' not in result