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

Allow keyboard to activate permalink #1162

Merged
merged 4 commits into from Jun 18, 2021
Merged
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: 6 additions & 0 deletions sphinx_rtd_theme/__init__.py
Expand Up @@ -55,4 +55,10 @@ def setup(app):
app.add_message_catalog('sphinx', rtd_locale_path)
app.connect('config-inited', config_initiated)

# sphinx emits the permalink icon for headers, so choose one more in keeping with our theme
if sphinx_version >= (3, 5, 0):
app.config.html_permalinks_icon = "\uf0c1"
else:
app.config.html_add_permalinks = "\uf0c1"

return {'parallel_read_safe': True, 'parallel_write_safe': True}
13 changes: 7 additions & 6 deletions src/sass/_theme_rst.sass
Expand Up @@ -200,14 +200,15 @@
// This is the #href that shows up on hover. Sphinx's is terrible so I hack it away.
h1, h2, h3, h4, h5, h6, dl dt, p.caption, table > caption, .code-block-caption
.headerlink
visibility: hidden
opacity: 0
Blendify marked this conversation as resolved.
Show resolved Hide resolved
font-size: 14px
font-family: FontAwesome
margin-left: 0.5em
@extend .fa
&:after
content: "\f0c1"
font-family: FontAwesome
Copy link
Member

Choose a reason for hiding this comment

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

Currently, the rendering does not match how it did previously because the font family should still be FontAwesome.

Also is there a reason behind the font size change and the adjusted margin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After losing the FontAwesome font family, I was adjusting the size and margin to match the original size better.

However, as you suggested, I put FontAwesome back to match the prior style even better. Did have to include a little left margin because the link icon was pressed right against the text otherwise when not in :after content.

&:hover .headerlink:after
visibility: visible
&:focus
opacity: 1
&:hover .headerlink
opacity: 1

// override the Wyrm accessibility anti-pattern of hiding button focus
.btn:focus
Expand Down