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

Fix focus ring glitch on API autosummary "[source]" link #1778

Merged
merged 1 commit into from
Apr 24, 2024
Merged
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
15 changes: 15 additions & 0 deletions src/pydata_sphinx_theme/assets/styles/content/_api.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ span.highlighted {
background-color: var(--pst-color-target);
}

dl > dt > a:has(.viewcode-link) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you know a way to improve the safety of this selector, please let me know!

// Sphinx applies a `float:right` rule to the .viewcode-line span, which
// exposes a browser glitch in the focus ring. It seems the browser creates
// two separate boxes, an empty box where the anchor element gets laid out and
// then another box around the anchor's contents that have been floated right.
// Firefox draws the focus ring around the empty anchor element box. Chrome
// draws two focus rings: one around the empty anchor and one around the
// floated-right element. To fix the glitch, we apply the float rule on the
// parent rather than the child.
float: right;
.viewcode-link {
float: none;
}
}

/*******************************************************************************
* Styling for autosummary titles like "parameters" and "returns"
*/
Expand Down
Loading