Skip to content
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

Make version picker keyboard-controllable #1160

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
{%- block footer %}
{%- if not READTHEDOCS %}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="{{ _('Versions') }}">
<span class="rst-current-version" data-toggle="rst-current-version">
<button class="rst-current-version" aria-expanded="false" aria-controls="docs_versions" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
v: latest
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
</button>
<div class="rst-other-versions" id="docs_versions">
<dl>
<dt>{{ _('Versions') }}</dt>
{%- if test_versions %}
Expand Down
6 changes: 3 additions & 3 deletions sphinx_rtd_theme/versions.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% if READTHEDOCS %}
{# Add rst-badge after rst-versions for small badge style. #}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="{{ _('Versions') }}">
<span class="rst-current-version" data-toggle="rst-current-version">
<button class="rst-current-version" aria-expanded="false" aria-controls="docs_versions" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
v: {{ current_version }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
</button>
<div class="rst-other-versions" id="docs_versions">
Comment on lines -4 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<dl>
<dt>{{ _('Versions') }}</dt>
{% for slug, url in versions %}
Expand Down
1 change: 1 addition & 0 deletions src/sass/_theme_badge.sass
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
font-size: 90%
cursor: pointer
color: $green
width: 100%
+clearfix
.fa
color: $section-background-color
Expand Down
6 changes: 6 additions & 0 deletions src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ function ThemeNav () {
self.hashChange();
})
.on('click', "[data-toggle='rst-current-version']", function() {
var target = $(this);
$("[data-toggle='rst-versions']").toggleClass("shift-up");
target.attr(
'aria-expanded',
$("[data-toggle='rst-versions']").hasClass("shift-up") ?
"true" : "false"
);
})

// Make tables responsive
Expand Down