Skip to content

Commit bb19e7d

Browse files
trallarddrammock
andauthored
ENH - Update links styling (#1353)
* ♿ Add basic links style * Update link styles for sidebars * ♿️ Replace more links - sidebars and TOC * ♿ Add basic links style * Update link styles for sidebars * ♿️ Replace more links - sidebars and TOC * ♿️ Update navigation links style * 📝 Update accessibility docs * ♿ Update more links styles * Update icon links style * Remove duplicate styles * 💄 Update base link style * 💄 Update navigation styles * Apply suggestions from code review Co-authored-by: Daniel McCloy <[email protected]> * Fix sidebar links - hover * 🚚 Move helpers into separate files * ♿ Ensure current styles are current and not active * ♿ Ensure current links are consistent * ♿ Fix TOC hover links * 💄 Ensure prev-next are purple on hover * Update active + hover style * ♿ Fix hover on dropdowns * Unify link styles -icons and navigation * Ensure navbar links behave under hover * Add temporary focus style * Remove underline from breadcrumbs * remove EnOSlib (temporarily) to restore doc build * remove expectation of EnOSlib warning * 💄 Remove visited colour * Add focus style to search box --------- Co-authored-by: Daniel McCloy <[email protected]>
1 parent eb8bdee commit bb19e7d

27 files changed

+648
-486
lines changed

docs/_static/custom.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* Background of stable should be green */
22
.version-switcher__container a[data-version-name*="stable"] {
33
position: relative;
4+
background-color: var(--pst-color-success-bg);
5+
box-shadow: inset 3px 0px 0px var(--pst-color-success);
46
}
57

68
.version-switcher__container a[data-version-name*="stable"] span {
@@ -14,8 +16,6 @@
1416
position: absolute;
1517
left: 0;
1618
top: 0;
17-
background-color: var(--pst-color-success);
18-
opacity: 0.1;
1919
}
2020

2121
/* custom CSS classes (used in docs/user_guide/extending.rst) NOTE: the begin

docs/_static/gallery.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
- title: SEPAL
5757
website: https://docs.sepal.io/en/latest/index.html
5858
img-bottom: ../_static/gallery/sepal.png
59-
- title: EnOSlib
60-
website: https://discovery.gitlabpages.inria.fr/enoslib/
61-
img-bottom: ../_static/gallery/enoslib.png
6259
- title: Matplotlib
6360
website: https://matplotlib.org/stable/
6461
img-bottom: ../_static/gallery/matplotlib.png

docs/community/topics/accessibility.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ We run a [Lighthouse](https://developers.google.com/web/tools/lighthouse) job in
1515
The configuration for Lighthouse can be found in the `.github/workflows/lighthouserc.json` file.
1616

1717
For more information about configuring Lighthouse, see [the Lighthouse documentation](https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md).
18-
For more information about Accessibility in general, see [](../../user_guide/accessibility.rst).
18+
For more information about Accessibility in general, see [](../../user_guide/accessibility.md).
19+
20+
We have also recently added automated tests using [Playwright](https://playwright.dev/python/) and [axe-core](https://github.com/dequelabs/axe-core) to improve our accessibility testing and reporting.

docs/user_guide/accessibility.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Accessibility
2+
3+
Creating and publishing content that does not exclude disabled users is a complex and iterative task.
4+
5+
While there is no one-size-fits-all solution to maintaining accessible content,
6+
the PyData Sphinx Theme and this documentation site use some techniques to avoid common content shortcomings.
7+
8+
:::{note}
9+
Issues and pull requests to identify or fix accessibility issues on this theme or site are heartily welcomed!
10+
:::
11+
12+
## What We've Done
13+
14+
### Metadata
15+
16+
Several of our documentation pages contain metadata (i.e., `.. meta::` directives
17+
in reStructuredText) giving summaries of the page contents. If you notice a
18+
page that lacks metadata, please open a pull request to add it!
19+
20+
### Colors
21+
22+
- Our default code highlighting styles are `a11y-high-contrast-light` and
23+
`a11y-high-contrast-dark` from https://github.com/Quansight-Labs/accessible-pygments.
24+
These styles are designed to meet WCAG 2 AA or AAA contrast requirements.
25+
If you don't like the look of our default code highlighting styles, there are several more
26+
to choose from at https://github.com/Quansight-Labs/accessible-pygments.
27+
- We recently revisited the PyData Sphinx theme color palette to ensure that
28+
the colors we use meet WCAG 2 AA or AAA contrast requirements.
29+
- We also re-defined our `primary` and `secondary` colors to be more accessible and distinct from semantic colors used
30+
to denote success, warning, info, and danger contexts or information.
31+
- We simplified the color palette and removed some colors that were problematic in meeting WCAG 2 AA or AAA contrast requirements
32+
and for certain types of colorblindness.
33+
- We have improved how we assign text colors to interactive elements such as buttons and dropdowns to ensure that they meet
34+
WCAG 2 AA or AAA contrast requirements.
35+
36+
## What You Can Do
37+
38+
### Site configuration
39+
40+
The following sections include recommendations for settings in the `conf.py` file that can positively impact the
41+
accessibility of content generated by this theme and Sphinx in general.
42+
43+
### Natural Language
44+
45+
If not using a more robust [internationalization approach](https://www.sphinx-doc.org/en/master/usage/advanced/intl.html),
46+
specifying at least the baseline natural language will help assistive technology
47+
identify if the content is in a language the reader understands.
48+
49+
:::{hint}
50+
In your `conf.py` file, [specifying the language your docs are written in](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language) will propagate to the top-level `HTML` tag.
51+
52+
```python
53+
language = "en"
54+
```
55+
56+
:::
57+
58+
### Add a Site Map
59+
60+
Site maps, usually served from a file called `sitemap.xml` are a broadly-employed
61+
approach to telling programs like search engines and assistive technologies where
62+
different content appears on a website.
63+
64+
If using a service like [ReadTheDocs](https://readthedocs.com), these files
65+
will be created for you _automatically_, but for some other approaches below,
66+
it's handy to generate a `sitemap.xml` locally or in CI with a tool like
67+
[sphinx-sitemap](https://pypi.org/project/sphinx-sitemap/).
68+
69+
:::{hint}
70+
71+
For a simple site (no extra languages or versions), ensure `sphinx-sitemap`
72+
is installed in your documentation environment, and modify your `conf.py`:
73+
74+
```python
75+
extensions += ["sphinx_sitemap"]
76+
77+
html_baseurl = os.environ.get("SPHINX_HTML_BASE_URL", "http://127.0.0.1:8000/")
78+
sitemap_locales = [None]
79+
sitemap_url_scheme = "{link}"
80+
```
81+
82+
:::
83+
84+
### Logo best practices
85+
86+
If you use both light and dark themes, it's best to provide a logo that works well in both or to provide an alternative for the dark theme.
87+
If you have a logo, you can add alt-text to it by adding the following to your
88+
`conf.py`:
89+
90+
```python
91+
"logo": {
92+
"text": "PyData Theme",
93+
"image_dark": "_static/logo-dark.svg",
94+
"alt_text": "PyData Theme home",
95+
},
96+
```
97+
98+
Note the use of "home" in the alt text to indicate that the logo is also a link to the home page.
99+
100+
### In the Browser
101+
102+
Several in-browser tools exist for interactively debugging the accessibility
103+
of a single page at a time and can be useful during the content development cycle.
104+
105+
### Built-in tools
106+
107+
Most major browsers, including [Firefox](https://developer.mozilla.org/en-US/docs/Tools/Accessibility_inspector)
108+
and [Chrome](https://developers.google.com/web/tools/chrome-devtools/accessibility/reference),
109+
have accessibility tools built-in as part of their web developer tools.
110+
These tools can help to quickly identify accessibility issues and often include links to standards.
111+
112+
#### tota11y
113+
114+
[tota11y](https://khan.github.io/tota11y/#Installation) is an open source
115+
"bookmarklet" which modifies the currently-loaded page in place and highlights
116+
several accessibility issues.
117+
118+
#### WAVE
119+
120+
[WAVE](https://wave.webaim.org/extension/) is a proprietary (but _gratis_)
121+
browser extension which can highlight multiple issues.
122+
123+
:::{warning}
124+
Note that automated testing and extensions such as the ones mentioned above will at best catch 30-40% of accessibility issues.
125+
They are not a replacement for manual testing and having a perfect score on any of these tools does not mean that
126+
the site can be used by disabled users but instead signals that it follows some accessibility best practices.
127+
:::
128+
129+
### In Continuous Integration
130+
131+
Several automated tools are available for assessing _glaring_ accessibility
132+
issues across some pages at once, usually with many configurable options.
133+
134+
#### Lighthouse
135+
136+
[Lighthouse](https://developers.google.com/web/tools/lighthouse) provides an automated assessment of basic accessibility issues in addition to search engine
137+
automation, page performance, and other best practices.
138+
139+
:::{hint}
140+
Specifically, [foo-software/lighthouse-check-action](https://github.com/foo-software/lighthouse-check-action)
141+
is run on selected pages from the generated documentation site.
142+
:::

docs/user_guide/accessibility.rst

Lines changed: 0 additions & 173 deletions
This file was deleted.

0 commit comments

Comments
 (0)