Skip to content

Commit 441c98d

Browse files
authored
CI - Fix three separate test failures (a11y, Sphinx dev, Sphinx 7.3) (#2204)
Fixes #2199. This should also: - fix the a11y-tests CI check which is currently failing on all new PRs - fix a warning that occurs whenever Sphinx >= 7.3 is used - fix a warning that occurs when the latest/dev version of Sphinx is used ### How to test Run a contrast checker on the following preview build pages. Check each page both in **light mode** and **dark mode**: 1. [Read the Docs - PR 2204 - Kitchen Sink - Tables](https://pydata-sphinx-theme--2204.org.readthedocs.build/en/2204/examples/kitchen-sink/tables.html) - specifically check "list tables" 2. [Read the Docs - PR 2204 - Kitchen Sink - Admonitions](https://pydata-sphinx-theme--2204.org.readthedocs.build/en/2204/examples/kitchen-sink/admonitions.html) - specifically check the following five admonitions: topic, version added, version changed, deprecated and version removed ### Screenshots The following two screenshots, one for light mode and one for dark mode, show the topic admonition (with higher contrast link) above a regular admonition to show the difference between the regular contrast link color versus the higher contrast link color. <img width="746" alt="light mode topic admonition shown next to normal admonition" src="https://github.com/user-attachments/assets/6725331f-c107-4345-a056-e21e395353f2" /> <img width="746" alt="dark mode topic admonition shown next to normal admonition" src="https://github.com/user-attachments/assets/9b4def23-5d68-4dc9-af10-47ad362f431e" /> <br/> <br/> The following two screenshots, one for light mode and one for dark mode, show the four different version-related admonitions, which use higher contrast links, below a warning admonition, which uses regular contrast. <img width="746" alt="five light mode admonitions shown together, four of which have higher contrast links" src="https://github.com/user-attachments/assets/7ab7e1d2-cc05-4b23-a1bb-132eb2aa253f" /> <br/> <br/> Note that in the version changed admonition (dark mode), the link color is even higher contrast (teal-300) than the other higher contrast links (teal-400). <img width="746" alt="five dark mode admonitions shown together, four of which have higher contrast links" src="https://github.com/user-attachments/assets/9941ead6-b038-4de0-b8c8-f92f716bd08c" /> <br/> <br/> The following two screenshots show the same table in light and dark mode (all of the links use the higher contrast color). <img width="746" alt="light mode table with links" src="https://github.com/user-attachments/assets/22b087fe-facc-4cff-8fe9-6558edff29a8" /> <img width="746" alt="dark mode table with links" src="https://github.com/user-attachments/assets/8796cda5-ebd9-4769-a689-03c2e3bd5870" />
1 parent 400fdc1 commit 441c98d

File tree

20 files changed

+66
-14
lines changed

20 files changed

+66
-14
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,8 @@ jobs:
101101
# ensuring proper scaping of the variable
102102
docs_dir="${DOCS_DIR}"
103103
mkdir -p $docs_dir/site
104-
cp -r docs/examples/kitchen-sink $docs_dir/site/kitchen-sink
105-
printf "Test\n====\n\n.. toctree::\n\n kitchen-sink/index\n" > $docs_dir/site/index.rst
104+
cp -r docs/examples/kitchen-sink/* $docs_dir/site/
106105
echo 'html_theme = "pydata_sphinx_theme"' > $docs_dir/site/conf.py
107-
echo '.. toctree::\n :glob:\n\n *' >> $docs_dir/site/index.rst
108106
109107
# build docs without checking for warnings
110108
python -Im tox run -e docs-no-checks

.github/workflows/lighthouserc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"ci": {
33
"collect": {
4-
"staticDistDir": "./audit/_build/kitchen-sink/",
4+
"staticDistDir": "./audit/_build/",
5+
"autodiscoverUrlBlocklist": [
6+
"/genindex.html",
7+
"/search.html",
8+
"/_static/webpack-macros.html"
9+
],
510
"settings": {
611
"skipAudits": ["canonical"]
712
}

docs/community/inspiration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ When making new decisions about design and UI/UX, we often consult these themes
2020
image: ../_static/inspiration/docker-mark-blue.svg
2121
- title: "**PyTorch**"
2222
link: https://pytorch.org/docs/stable/index.html
23-
image: https://pytorch.org/assets/images/pytorch-logo.png
23+
image: https://docs.pytorch.org/docs/stable/_static/images/logo-dark.svg
2424
- title: "**Docasaurus**"
2525
link: https://docusaurus.io/docs
2626
image: https://d33wubrfki0l68.cloudfront.net/c088b7acfcf11100903c44fe44f2f2d7e0f30531/47727/img/docusaurus.svg

docs/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,6 @@ def setup(app: Sphinx) -> Dict[str, Any]:
369369
# The crawler gets "Anchor not found" for various anchors
370370
r"https://github.com.+?#.*",
371371
r"https://www.sphinx-doc.org/en/master/*/.+?#.+?",
372-
# Known broken links in kitchen sink
373-
r"https://source.unsplash.com/.+",
374372
# sample urls
375373
"http://someurl/release-0.1.0.tar-gz",
376374
"http://python.py",

src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
color: var(--pst-color-table);
2727
border: 1px solid var(--pst-color-table-outer-border);
2828

29+
// Our tables are zebra striped: header rows and odd-numbered rows have an
30+
// off-white background, or off-black in dark mode. So they require a
31+
// higher contrast link color.
32+
a {
33+
color: var(--pst-color-link-higher-contrast);
34+
}
35+
2936
th,
3037
td {
3138
~ th,

src/pydata_sphinx_theme/assets/styles/components/_versionmodified.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ div.versionremoved {
2323
margin-bottom: 0.6rem;
2424
margin-top: 0.6rem;
2525
}
26+
27+
// fix color contrast failures (accessibility)
28+
a {
29+
color: var(--pst-color-link-higher-contrast);
30+
}
2631
}
2732

2833
div.versionadded {
@@ -33,6 +38,14 @@ div.versionadded {
3338
div.versionchanged {
3439
border-color: var(--pst-color-warning);
3540
background-color: var(--pst-color-warning-bg);
41+
42+
html[data-theme="dark"] & {
43+
// This is a one-off because `--pst-color-link-higher-contrast` works for
44+
// all of the other admonitions except this one in dark mode.
45+
a {
46+
color: map-deep-get($color-palette, "teal", "300");
47+
}
48+
}
3649
}
3750

3851
div.deprecated,

src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ aside.topic {
300300
color: var(--pst-color-on-surface) !important;
301301
}
302302

303+
a {
304+
color: var(--pst-color-link-higher-contrast);
305+
}
306+
303307
// Over-ride large default padding
304308
ul.simple {
305309
padding-left: 1rem;

src/pydata_sphinx_theme/assets/styles/content/_code.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ code.literal {
5858
}
5959

6060
a > code {
61-
color: var(--pst-color-inline-code-links);
61+
color: var(--pst-color-link-higher-contrast);
6262

6363
&:hover {
6464
color: var(--pst-color-link-hover);

src/pydata_sphinx_theme/assets/styles/content/_quotes.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ blockquote {
2626

2727
// Ensure there is enough contrast against the background
2828
a {
29-
color: var(--pst-color-inline-code-links);
29+
color: var(--pst-color-link-higher-contrast);
3030
}
3131

3232
// hack to make the text in the blockquote selectable

src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
// Ensure there is enough contrast against the background
3838
a {
39-
color: var(--pst-color-inline-code-links);
39+
color: var(--pst-color-link-higher-contrast);
4040
}
4141

4242
// The "Switch to stable version" link (styled like a button)

0 commit comments

Comments
 (0)