Skip to content

Commit 3d58dcc

Browse files
authored
Merge branch 'main' into main
2 parents caf0918 + 1458d70 commit 3d58dcc

40 files changed

Lines changed: 3132 additions & 1126 deletions

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ public/p5.min.js
3131
# optional local preferences for vscode
3232
local.code-workspace
3333
.zed
34+
35+
# Playwright accessibility test output
36+
test-results/
37+
playwright-report/

‎astro.config.mjs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ if (shouldSkipCompress) {
1616
console.log("WILL SKIP COMPRESS BUILD STEP");
1717
}
1818

19+
const isA11yTest = Boolean(process.env.A11Y_TEST);
20+
1921
// https://astro.build/config
2022
export default defineConfig({
2123
site: 'https://p5js.org',
2224
compressHTML: false,
25+
devToolbar: {
26+
enabled: !isA11yTest,
27+
},
2328
integrations: [
2429
mermaid({autoTheme: true}),
2530
preact({

‎docs/localization.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Each file within these collection folders corresponds to a real page on the rend
1818

1919
The ["ui" content collection](src/content/ui/) is a little different than the others. It contains yaml files that cover strings that are used across different pages for things like the navigation bar.
2020

21+
**Note on Translating Examples:**
22+
When translating Example pages (`.mdx`), you do not need to copy or include the `remix` metadata block in the frontmatter. The website will automatically fall back to the English version to fetch the remix data. This allows the copyright notice and attribution to be consistent.
23+
2124
## Routes and Layouts
2225

2326
Astro uses a file-based approach to generating routes. The filepath of each file in `src/pages` becomes the url of the page it renders. Because we need to support a url scheme where English translations of pages are served at a URL with no locale prefix (for example, the English version of the tutorials page is at https://p5.js/tutorials _not_ https://p5.js/en/tutorials), there are 2 sets of routing files and folders: one in `src/pages` and another `src/pages/[locale]`. The `[locale]` set are needed to build and serve the non-English pages (whose URLs are also prefixed by the language codes).

‎package-lock.json‎

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"deploy": "wrangler deploy --env beta",
1414
"astro": "astro",
1515
"test": "vitest",
16+
"test:a11y": "playwright test",
1617
"build:contributor-docs": "tsx ./src/scripts/builders/contribute.ts",
1718
"build:contributors": "tsx ./src/scripts/builders/people.ts",
1819
"build:reference": "tsx ./src/scripts/builders/reference.ts",
@@ -59,6 +60,7 @@
5960
"vite": "^7"
6061
},
6162
"devDependencies": {
63+
"@axe-core/playwright": "^4.12.1",
6264
"@codemirror/lang-javascript": "^6.2.2",
6365
"@playwright/test": "^1.54.1",
6466
"@preact/preset-vite": "^2.10.5",

‎playwright.config.ts‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { defineConfig, devices } from "@playwright/test";
2+
3+
const PORT = 4321;
4+
const BASE_URL = `http://localhost:${PORT}`;
5+
6+
export default defineConfig({
7+
testDir: "./test/a11y",
8+
testMatch: "**/*.spec.ts",
9+
outputDir: "./test-results",
10+
fullyParallel: true,
11+
reporter: [
12+
["list"],
13+
['html', { outputFolder: 'playwright-report', open: 'never' }]
14+
],
15+
16+
use: {
17+
baseURL: BASE_URL,
18+
trace: "on-first-retry",
19+
},
20+
21+
// One engine, two viewports. axe-core inspects the DOM and computed styles,
22+
// which agree across engines, so a browser matrix mostly re-runs the same
23+
// assertions; a responsive layout can ship genuinely different markup per
24+
// breakpoint, so that is the axis worth covering.
25+
projects: [
26+
{
27+
name: "desktop",
28+
use: { ...devices["Desktop Chrome"] },
29+
},
30+
{
31+
name: "mobile",
32+
use: { ...devices["Pixel 5"] },
33+
},
34+
],
35+
36+
webServer: {
37+
command: "npm run dev",
38+
url: BASE_URL,
39+
reuseExistingServer: true,
40+
timeout: 180_000,
41+
env: {
42+
A11Y_TEST: "1",
43+
},
44+
},
45+
});

‎public/assets/hand.jpg‎

17.4 KB
Loading

‎public/assets/hat.jpg‎

273 KB
Loading

‎src/components/EducationResource/index.astro‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ const authorHTML = (await Astro.slots.render("author")).replace(/\<p[^\>]*\>/gm,
2525
<div set:html={authorHTML} />
2626
<slot name="description" />
2727
</div>
28-
<div class="text-sm leading-8 [&_a]:whitespace-nowrap [&_a]:rounded-full [&_a]:mr-1 [&_a]:py-1 [&_a]:px-2 [&_a]:outline [&_a]:outline-1 [&_a]:outline-[var(--type-magenta-dark)]">
28+
<!-- Materials render as outlined pills, so drop the persistent underline
29+
that .rendered-markdown links get, but keep the hover underline. The
30+
!important is needed to beat .rendered-markdown, and would otherwise
31+
kill :hover too -- hence the second utility. -->
32+
<div class="text-sm leading-8 [&_a]:whitespace-nowrap [&_a]:rounded-full [&_a]:mr-1 [&_a]:py-1 [&_a]:px-2 [&_a]:outline-1 [&_a]:outline-(--type-magenta-dark) [&_a]:no-underline! [&_a]:hover:underline!">
2933
<slot name="materials" />
3034
</div>
3135
</div>

‎src/components/Nav/styles.module.scss‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,14 @@
8787

8888
&:global(.open),
8989
&:global(.noJumpTo) {
90-
grid-template-rows: min-content 2fr;
90+
grid-template-rows: min-content 1fr min-content;
9191
min-height: 350px;
92-
height: 100%;
92+
height: auto;
93+
max-height: none;
94+
}
95+
96+
&:global(.noJumpTo) {
97+
flex-grow: 1;
9398
}
9499
}
95100

@@ -128,6 +133,12 @@
128133
}
129134
}
130135

136+
@media (min-width: variables.$breakpoint-tablet) {
137+
.container:has(.jumpto:not(:global(.open))) .mainlinks:global(.open) {
138+
flex-grow: 1;
139+
}
140+
}
141+
131142
.jumpto {
132143
border-color: var(--sidebar-type-color);
133144

@@ -176,11 +187,13 @@
176187

177188
@media (min-width: variables.$breakpoint-tablet) {
178189
height: fit-content;
190+
flex-grow: 0;
179191
border-top-width: 1px;
180-
margin-top: auto;
181192

182193
&:global(.open) {
183-
height: 100%;
194+
height: auto;
195+
min-height: 0;
196+
flex-grow: 1;
184197
overflow-y: scroll;
185198
}
186199

@@ -270,7 +283,8 @@
270283
height: unset;
271284

272285
@media (min-width: variables.$breakpoint-tablet) {
273-
height: 100%;
286+
height: auto;
287+
min-height: 0;
274288
overflow-y: scroll;
275289

276290
ul {
@@ -287,4 +301,3 @@
287301
.jumpto ul li.linklabel:not(:global(.small), :first-child) {
288302
margin-top: 10px;
289303
}
290-

0 commit comments

Comments
 (0)