From 00b2ec7d5c719ffa8f0f77d3285fc9ad5a5b3d96 Mon Sep 17 00:00:00 2001 From: Schluffe Date: Fri, 9 Oct 2026 14:55:05 +0200 Subject: [PATCH] Improve a11y --- README.md | 6 ++-- bun.lock | 15 ++++++---- package.json | 7 +++-- scripts/browser-check.ts | 19 ++++++++++++ src/App.vue | 25 +++++++++------- src/components/NetworkSettings.vue | 12 ++++++-- src/components/TransferPanel.vue | 9 ++++-- src/style.css | 47 +++++++++++++++++++++++++----- 8 files changed, 105 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index d12fbd7..6cef9f7 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,9 @@ relay candidates it accepts, not arbitrary software run by the other person. When a credential endpoint is configured (including the local development setup below), **Use the configured relay with temporary credentials** replaces manual credential entry. The app fetches fresh credentials for each new connection, -only after TURN opt-in. Uncheck it to use a different relay manually. +only after TURN opt-in. The issued relay address, username and masked password +appear in read-only fields while the connection is active. Uncheck it to use a +different relay manually. TURN credentials stay in the current component's memory; the app does not persist them or include them in codes. The relay receives its authentication exchange and @@ -150,7 +152,7 @@ bun run test # protocol and temporary-credential unit tests bun run test:turn # real Chromium file transfer, forced TURN/UDP bun run test:turn --tcp # same test, TURN/TCP only bun run build -bun run test:browser # direct-path browser regressions +bun run test:browser # direct-path browser regressions and axe accessibility checks docker compose --env-file .env.development logs --tail=50 coturn ``` diff --git a/bun.lock b/bun.lock index 5a59402..d1a9bfe 100644 --- a/bun.lock +++ b/bun.lock @@ -8,10 +8,11 @@ "vue": "^3.5.43", }, "devDependencies": { - "@types/node": "^22", + "@types/node": "^26.6.4", "@vitejs/plugin-vue": "^6.0.9", - "typescript": "~5.9.3", - "vite": "^8", + "axe-core": "^4.14.0", + "typescript": "~6.0.3", + "vite": "^8.3.4", "vue-tsc": "^3.3.12", }, }, @@ -61,7 +62,7 @@ "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="], - "@types/node": ["@types/node@22.20.5", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA=="], + "@types/node": ["@types/node@26.6.4", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-ldVPDCzj7fsaGZrLB0NuHuTvJcsNasysBAqMolr/cgxrLd1xbqxIr3XJiPnHHJUCxj5sNF1vnRj9aWnrVh5Jcg=="], "@vitejs/plugin-vue": ["@vitejs/plugin-vue@6.0.9", "", { "dependencies": { "@rolldown/pluginutils": "^1.0.1" }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", "vue": "^3.2.25" } }, "sha512-rD/MORlhaZMlXWW0rEn4FB4wMinWC0z/D7Ye160S5+Rs1mC8ZDAdcDp4SjKfUhG5t8q1ktcPVw4xuTkPRlzrSA=="], @@ -93,6 +94,8 @@ "alien-signals": ["alien-signals@3.2.1", "", {}, "sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g=="], + "axe-core": ["axe-core@4.14.0", "", {}, "sha512-9WTZxEjsZ7b13TH8JPmbV2z8CHbl80/2hm3XPEG4JgNdQLK81IBRXmSxHfMAOkSqQeRxT/0dwNDz2GOm3zzpcQ=="], + "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], @@ -149,9 +152,9 @@ "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], - "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="], - "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + "undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], "vite": ["vite@8.3.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.29", "rolldown": "~1.2.12", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="], diff --git a/package.json b/package.json index 313151e..49c5243 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,11 @@ "vue": "^3.5.43" }, "devDependencies": { - "@types/node": "^22", + "@types/node": "^26.6.4", "@vitejs/plugin-vue": "^6.0.9", - "typescript": "~5.9.3", - "vite": "^8", + "axe-core": "^4.14.0", + "typescript": "~6.0.3", + "vite": "^8.3.4", "vue-tsc": "^3.3.12" }, "engines": { diff --git a/scripts/browser-check.ts b/scripts/browser-check.ts index 2518250..0061091 100644 --- a/scripts/browser-check.ts +++ b/scripts/browser-check.ts @@ -9,6 +9,7 @@ import { tmpdir } from 'node:os'; import { dirname, extname, join, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; const root = resolve(dirname(fileURLToPath(import.meta.url)), '..'); +const axeSource = await readFile(join(root, 'node_modules/axe-core/axe.min.js'), 'utf8'); const provider = process.argv.includes('--default-network') ? 'google' : 'none'; const turn = process.argv.includes('--turn'); const transport = process.argv.includes('--tcp') ? 'tcp' : 'udp'; @@ -103,6 +104,16 @@ async function page() { await wait(sessionId, () => !!document.querySelector('#stun-provider')); return sessionId; } +async function checkAccessibility(session: string, mode: string) { + const injected = await call('Runtime.evaluate', { expression: axeSource }, session); + assert.equal(injected.exceptionDetails, undefined, 'axe-core should load in the page'); + const violations = await evaluate(session, async () => { + const axe = (window as unknown as { axe: { run: (context: Document) => Promise<{ violations: Array<{ id: string; nodes: Array<{ target: string[] }> }> }> } }).axe; + const results = await axe.run(document); + return results.violations.map(({ id, nodes }) => ({ id, targets: nodes.map(({ target }) => target) })); + }); + assert.deepEqual(violations, [], `${mode} mode accessibility violations`); +} const click = (session: string, label: string) => evaluate(session, (label: string) => window.__hellcon.click(label), label); const input = (session: string, selector: string, value: string) => evaluate(session, (selector: string, value: string) => window.__hellcon.input(selector, value), selector, value); const enableTurn = (session: string) => evaluate(session, () => { @@ -149,10 +160,18 @@ async function connect(sender: string, receiver: string, size: number) { try { const sender = await page(), receiver = await page(); await click(receiver, 'Receive'); + await checkAccessibility(sender, 'Send'); + await checkAccessibility(receiver, 'Receive'); + console.log('PASS: axe-core accessibility scan in initial Send and Receive modes.'); assert.equal(await evaluate(sender, () => window.__hellcon.element('.checkbox input').checked), false); await connect(sender, receiver, 2 * 1024 * 1024 + 7); + await checkAccessibility(sender, 'Send during transfer'); + await checkAccessibility(receiver, 'Receive before accepting a file'); await click(receiver, 'Receive in memory (up to 64 MiB)'); await wait(sender, () => window.__hellcon.element('[role=status]').textContent?.includes('confirmed the complete file')); + await checkAccessibility(sender, 'Send after transfer'); + await checkAccessibility(receiver, 'Receive after transfer'); + console.log('PASS: axe-core accessibility scan during and after transfer.'); const data = await evaluate(receiver, async () => { const response = await fetch(window.__hellcon.element('a.download').href); const bytes = new Uint8Array(await response.arrayBuffer()); diff --git a/src/App.vue b/src/App.vue index 578dd1e..d1dea56 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,19 +7,22 @@ const mode = ref<'send' | 'receive'>('send');