Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sphinx_rtd_theme/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
{#- Translators: This is an ARIA section label for sequential page links, such as previous and next page links. -#}
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="{{ _('Sequential page navigation') }}">
{%- if prev %}
<a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> {{ _('Previous') }}</a>
<a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}"{% if theme_prev_next_buttons_location == 'top' %} accesskey="p"{% endif %}><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> {{ _('Previous') }}</a>
{%- endif %}
{%- if next %}
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n">{{ _('Next') }} <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}"{% if theme_prev_next_buttons_location == 'top' %} accesskey="n"{% endif %}>{{ _('Next') }} <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
{%- endif %}
</div>
{%- endif %}
Expand Down
16 changes: 15 additions & 1 deletion tests/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
SingleFileHTMLBuilder,
)

from .util import build_all
from .util import build, build_all


def test_basic():
Expand Down Expand Up @@ -88,3 +88,17 @@ def test_missing_toctree():
content = open(os.path.join(app.outdir, 'index.html')).read()
assert '<div class="toctree' not in content
assert '<div class="local-toc">' in content


def test_prev_next_accesskeys_are_unique_when_buttons_location_is_both():
confoverrides = {
'html_theme_options': {
'prev_next_buttons_location': 'both',
},
}

with build('test-basic', confoverrides=confoverrides) as (app, status, warning):
content = open(os.path.join(app.outdir, 'foo.html'), encoding='utf-8').read()

assert content.count('accesskey="p"') == 1
assert content.count('accesskey="n"') == 1