Skip to content

Unnecessarily broad style rule on a:before produces unwanted side-effects #1156

@bheberlein

Description

@bheberlein

I notice that in pydata-sphinx-theme.css (v0.12.0), we have this style rule:

a:before{
    color:var(--pst-color-text-muted);
    font-family:Font Awesome\ 6 Brands;
    margin-right:.25rem
}

This selector seems much too general, and produces unwanted side-effects. For example, if I create footnote citations with ReST like so:

This model derives from the work of Smith\ [#Smith2023]_.

|

.. rubric:: Footnotes

.. [#Smith2023] Smith J (2023). Citation goes here.

...then the opening bracket (both in the main body and in the footnotes) will be rendered in a different font and color than the citation number and closing bracket; it also has the odd right margin that makes the whole bracketed reference asymmetrical:

The opening bracket also does not inherit styles associated with hovering the cursor over the link (though this seems to be a separate issue).

Of course I can add custom CSS to style these elements properly:

a.fn-backref:before, a.footnote-reference.brackets:before {
  color: var(--pst-color-link);
  font-family: var(--pst-font-family-base-system);
  margin-right: 0;
}

But this seems like a band-aid fix, rather than a solution to the underlying problem.

I am sure there is a particular case for which the style rule was written. Does anyone know what that is? I propose we can add additional selectors to the rule so that it does not have such unwanted side-effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions