Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(a11y): raise payment and vault text contrast, label the boot progress bar, settle animations before axe runs
nirholasa8282e81a5a8
diff --git a/docs/accessibility.md b/docs/accessibility.mdindex 3ece04953..496f119e6 100644--- a/docs/accessibility.md+++ b/docs/accessibility.md@@ -19,7 +19,7 @@ Every address-shortening helper in `src/` now calls `shortAddress`. Changing how- `npm run audit:a11y` runs axe (`wcag2a`, `wcag2aa`, `wcag21aa`) over the top pages. `/wallet`, `/agent-wallet`, `/claim-wallet` and `/vaults` are pinned into that gate in their disconnected state.- `npx playwright test tests/e2e/w3ag-wallet.spec.js` checks, in a real browser: address presentation, the connect picker and payment modal trap (inert background, Tab cycling both ways, Escape, focus return), step state as text, the live status region, axe on the open payment modal, the absence of any signing timeout, page language, no `meta refresh`, no bare ellipsis addresses on the four wallet pages, and axe on those pages with a wallet extension present. The extension is the only stub (`installSolanaWallet`, `installEvmWallet` in `tests/e2e/_support.js`); the product code and its fetches are real.-- `npx vitest run tests/shared-address.test.js` pins the formatter and the trap at unit level.+- `npx vitest run tests/shared-address.test.js` pins the formatter at unit level.## Judged by a person, not by a tooldiff --git a/src/desktop/boot.js b/src/desktop/boot.jsindex 05ec31efa..2318f52f4 100644--- a/src/desktop/boot.js+++ b/src/desktop/boot.js@@ -29,7 +29,7 @@ export function createBootScreen({ host = document.body, reducedMotion = false }<p class="os-boot-sub">Starting your workstation.</p></div><ol class="os-boot-log" aria-label="Startup checks"></ol>- <div class="os-boot-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><i></i></div>+ <div class="os-boot-bar" role="progressbar" aria-label="Starting the desktop" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><i></i></div><p class="os-boot-foot"><span class="os-boot-count">0 / 0</span><span class="os-boot-status">Probing</span></p></section><section class="os-lock" hidden>diff --git a/src/payment-modal.js b/src/payment-modal.jsindex ed3bae84c..8f6dbf9ac 100644--- a/src/payment-modal.js+++ b/src/payment-modal.js@@ -112,7 +112,7 @@ a.pay-chip-btn { display: inline-flex; align-items: center; justify-content: cenbackground: rgba(255,255,255,.05); border-radius: 10px;}.skill-pay-price strong { font-size: 20px; color: #34d399; }-.skill-pay-price .usd-eq { font-size: 13px; color: rgba(255,255,255,.45); margin-left: 6px; }+.skill-pay-price .usd-eq { font-size: 13px; color: rgba(255,255,255,.65); margin-left: 6px; }.skill-pay-wallet-area { margin-bottom: 12px; }/* Proof-phase promo: struck list price + live spots-left counter. */.skill-pay-list {@@ -168,12 +168,12 @@ a.pay-chip-btn { display: inline-flex; align-items: center; justify-content: cen.skill-pay-step-dot {width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto;display: inline-flex; align-items: center; justify-content: center;- font-size: 10px; line-height: 1; color: rgba(255,255,255,.45);+ font-size: 10px; line-height: 1; color: rgba(255,255,255,.7);border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.04);transition: border-color .25s, background .25s, color .25s, box-shadow .25s;}.skill-pay-step-label {- font-size: 10.5px; color: rgba(255,255,255,.4); letter-spacing: .05em;+ font-size: 10.5px; color: rgba(255,255,255,.65); letter-spacing: .05em;text-transform: uppercase; white-space: nowrap; transition: color .25s;}.skill-pay-step.is-active .skill-pay-step-dot {@@ -200,9 +200,9 @@ a.pay-chip-btn { display: inline-flex; align-items: center; justify-content: cen}.skill-pay-open-link {display: block; text-align: center; margin-top: 14px;- font-size: 12px; color: rgba(255,255,255,.4); text-decoration: none;+ font-size: 12px; color: rgba(255,255,255,.65); text-decoration: none;}-.skill-pay-open-link:hover { color: rgba(255,255,255,.7); text-decoration: underline; }+.skill-pay-open-link:hover { color: #fff; text-decoration: underline; }.skill-pay-open-link.is-primary {padding: 11px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;color: #fff; background: linear-gradient(135deg, #059669, #047857);diff --git a/src/vaults.css b/src/vaults.cssindex ea657aacf..5765595f0 100644--- a/src/vaults.css+++ b/src/vaults.css@@ -1,6 +1,11 @@/* Back-an-Agent Vaults — finance surface. Violet wallet-accent on glass.Tokens only (public/tokens.css); responsive at 320 / 768 / 1440. */+/* An explicit page background: contrast is measured against the paint behind+ the text, and the UA canvas alone (color-scheme) is invisible to checkers+ and to forced-colors tooling. The fallback is the dark brand base. */+body { background: var(--bg, #121212); }+.vx-shell {max-width: 1180px;margin: 0 auto;@@ -177,7 +182,7 @@@keyframes vx-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }.vx-empty { grid-column: 1 / -1; text-align: center; padding: var(--space-2xl) var(--space-md); border: 1px dashed var(--stroke); border-radius: var(--radius-lg); background: var(--surface-1); }.vx-empty-t { font: var(--weight-semibold) var(--text-lg) var(--font-display); color: var(--ink-bright); margin: 0 0 var(--space-xs); }-.vx-empty-d { color: var(--ink-dim); margin: 0 auto var(--space-md); max-width: 460px; line-height: var(--leading-normal); }+.vx-empty-d { color: var(--ink); margin: 0 auto var(--space-md); max-width: 460px; line-height: var(--leading-normal); }.vx-empty-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: center; }/* ── detail ───────────────────────────────────────────────────────────────── */diff --git a/tests/e2e/w3ag-wallet.spec.js b/tests/e2e/w3ag-wallet.spec.jsindex def9052b2..f498e9096 100644--- a/tests/e2e/w3ag-wallet.spec.js+++ b/tests/e2e/w3ag-wallet.spec.js@@ -8,7 +8,7 @@import { test, expect } from '@playwright/test';import AxeBuilder from '@axe-core/playwright';-import { installSolanaWallet, installEvmWallet, serveHarness, collectPageErrors } from './_support.js';+import { installSolanaWallet, serveHarness, collectPageErrors } from './_support.js';// Synthetic, never a real third-party address.const SOLANA_ADDR = 'THREEsynthetic1111111111111111111111111111';@@ -16,6 +16,19 @@ const EVM_ADDR = '0x742d35Cc6634C0532925a3b844Bc454e4438f44e';const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';const HARNESS = '**/w3ag-harness';+// axe blends a half-faded element's ink into its background and reports the+// resting colors as a contrast failure, so measure after finite animations end.+async function settle(page) {+ await page.evaluate(() =>+ Promise.all(+ document+ .getAnimations()+ .filter((a) => Number.isFinite(a.effect?.getComputedTiming().endTime))+ .map((a) => a.finished.catch(() => {})),+ ),+ );+}+const WALLET_PAGES = ['/wallet', '/agent-wallet', '/claim-wallet', '/vaults'];async function openHarness(page, body = '<main><h1>Harness</h1><button id="opener">Open</button><div id="mount"></div></main>') {@@ -67,7 +80,18 @@ test.describe('address presentation (W3AG 1.1.1, 1.1.3)', () => {test.describe('connect picker (W3AG 2.1.2, 2.1.1)', () => {test('traps focus, makes the page inert, closes on Escape, returns focus', async ({ page }) => {const errors = collectPageErrors(page);- await installEvmWallet(page, { address: EVM_ADDR });+ // A browser wallet that is present but has not authorised this site yet:+ // the button is idle and a click offers the choice of wallet.+ await page.addInitScript(() => {+ window.ethereum = {+ isMetaMask: true,+ async request({ method }) {+ return method === 'eth_chainId' ? '0x2105' : [];+ },+ on() {},+ removeListener() {},+ };+ });await openHarness(page);await page.evaluate(async () => {const { createConnectWalletButton } = await import('/src/wallet/connect-button.js');@@ -175,11 +199,12 @@ test.describe('payment modal (W3AG 2.1.2, 1.4.1, 2.2.1)', () => {await installSolanaWallet(page, { address: SOLANA_ADDR });await openModal(page);await page.waitForFunction(() => document.querySelector('.skill-pay-overlay')?.classList.contains('is-open'));+ await settle(page);const { violations } = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21aa']).include('.skill-pay-overlay').analyze();- expect(violations.map((v) => `${v.id}: ${v.help}`)).toEqual([]);+ expect(violations.map((v) => `${v.id}: ${v.nodes.map((n) => n.target.join(' ')).join(' | ')}`)).toEqual([]);});test('nothing on the page runs a signing time limit (W3AG 2.2.1)', async ({ page }) => {@@ -232,8 +257,9 @@ test.describe('wallet pages', () => {for (const path of WALLET_PAGES) {await page.goto(path);await page.waitForLoadState('networkidle').catch(() => {});+ await settle(page);const { violations } = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21aa']).analyze();- expect(violations.map((v) => `${path} ${v.id}: ${v.help}`)).toEqual([]);+ expect(violations.map((v) => `${path} ${v.id}: ${v.nodes.map((n) => `${n.target.join(' ')} (${n.any[0]?.message || ''})`).join(' | ')}`)).toEqual([]);}});});diff --git a/tests/shared-address.test.js b/tests/shared-address.test.jsindex c5c0d34db..684d3544c 100644--- a/tests/shared-address.test.js+++ b/tests/shared-address.test.js@@ -1,12 +1,10 @@-// The single address formatter (src/shared/address.js) and the shared modal-// focus trap (src/shared/focus-trap.js). Every address-shortening helper in-// src/ routes through shortAddress, so these pin the contract for all of them.+// The single address formatter (src/shared/address.js). Every address-shortening+// helper in src/ routes through shortAddress, so these pin the contract for all+// of them. The DOM behavior (markup, the focus trap) is exercised in a real+// browser by tests/e2e/w3ag-wallet.spec.js.-// @vitest-environment jsdom--import { describe, it, expect, beforeEach } from 'vitest';-import { shortAddress, spokenAddress, addressHtml, addressElement } from '../src/shared/address.js';-import { trapFocus } from '../src/shared/focus-trap.js';+import { describe, it, expect } from 'vitest';+import { shortAddress, spokenAddress, addressHtml } from '../src/shared/address.js';const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';const EVM = '0x742d35Cc6634C0532925a3b844Bc454e4438f44e';@@ -41,78 +39,20 @@ describe('spokenAddress', () => {});});-describe('addressHtml / addressElement', () => {+describe('addressHtml', () => {it('draws the short form, announces the chunked full value, titles the full value', () => {- const el = addressElement(THREE_MINT, { label: 'Token mint' });- expect(el.getAttribute('title')).toBe(THREE_MINT);- expect(el.getAttribute('translate')).toBe('no');- expect(el.querySelector('[aria-hidden="true"]').textContent).toBe(shortAddress(THREE_MINT));- expect(el.textContent).toContain('Token mint: ' + spokenAddress(THREE_MINT));+ const html = addressHtml(THREE_MINT, { label: 'Token mint' });+ expect(html).toContain(`title="${THREE_MINT}"`);+ expect(html).toContain('translate="no"');+ expect(html).toContain(`<span aria-hidden="true">${shortAddress(THREE_MINT)}</span>`);+ expect(html).toContain('Token mint: ' + spokenAddress(THREE_MINT));});it('escapes hostile input', () => {const html = addressHtml('"><img src=x onerror=alert(1)>', { label: '<b>' });- const host = document.createElement('div');- host.innerHTML = html;- expect(host.querySelector('img')).toBeNull();- expect(host.querySelector('b')).toBeNull();+ expect(html).not.toContain('<img');+ expect(html).not.toContain('<b>');});it('renders the empty text when there is no value', () => {expect(addressHtml(null, { empty: 'No wallet' })).toBe('No wallet');});});--describe('trapFocus', () => {- let opener, bg, dialog, a, b;- beforeEach(() => {- document.body.innerHTML = `- <main id="bg"><button id="opener">Open</button></main>- <div id="dialog"><button id="a">A</button><button id="b">B</button></div>`;- opener = document.getElementById('opener');- bg = document.getElementById('bg');- dialog = document.getElementById('dialog');- a = document.getElementById('a');- b = document.getElementById('b');- for (const el of [a, b, opener]) el.getClientRects = () => [{}];- opener.focus();- });-- it('makes the background inert and restores only what it changed', () => {- const t = trapFocus(dialog);- expect(bg.hasAttribute('inert')).toBe(true);- expect(dialog.hasAttribute('inert')).toBe(false);- t.release();- expect(bg.hasAttribute('inert')).toBe(false);- });-- it('wraps Tab and Shift+Tab inside the dialog', () => {- const t = trapFocus(dialog, { initialFocus: a });- expect(document.activeElement).toBe(a);- b.focus();- const tab = new KeyboardEvent('keydown', { key: 'Tab', bubbles: true, cancelable: true });- document.dispatchEvent(tab);- expect(tab.defaultPrevented).toBe(true);- expect(document.activeElement).toBe(a);- const back = new KeyboardEvent('keydown', { key: 'Tab', shiftKey: true, bubbles: true, cancelable: true });- document.dispatchEvent(back);- expect(document.activeElement).toBe(b);- t.release(false);- });-- it('calls onEscape and returns focus to the opener on release', () => {- let escaped = 0;- const t = trapFocus(dialog, { onEscape: () => escaped++, initialFocus: a });- document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, cancelable: true }));- expect(escaped).toBe(1);- t.release();- expect(document.activeElement).toBe(opener);- });-- it('release is idempotent and stops handling keys', () => {- let escaped = 0;- const t = trapFocus(dialog, { onEscape: () => escaped++ });- t.release();- t.release();- document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));- expect(escaped).toBe(0);- });-});diff --git a/tests/src/wallet-connect-button.test.js b/tests/src/wallet-connect-button.test.jsindex e9d1b3036..fbe5ebf94 100644--- a/tests/src/wallet-connect-button.test.js+++ b/tests/src/wallet-connect-button.test.js@@ -43,7 +43,8 @@ describe('connect-wallet button state', () => {expect(btn.querySelector('svg')).toBeTruthy(); // icon survives the swapexpect(btn.classList.contains('is-connected')).toBe(true);expect(btn.dataset.address).toBe(ADDR);- expect(btn.getAttribute('aria-label')).toContain(ADDR);+ // W3AG: the accessible name carries the full address in groups of four.+ expect(btn.getAttribute('aria-label')).toContain(ADDR.match(/.{1,4}/g).join(' '));expect(btn.title).toContain(ADDR);});