From 96c5a7741d10c13f9756c3eedcb9e34c0b93bc50 Mon Sep 17 00:00:00 2001 From: Algis Dumbris Date: Tue, 25 Aug 2026 14:56:00 +0300 Subject: [PATCH 1/8] fix(webui): AA contrast, system theme, mobile layout and a11y gaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Web UI UX audit (docs/qa/ux-audit-webui-2026-08.md), visual/theming/a11y cluster: F9, F14, F21, F29, F30, F32, F35 and the F36 items in this area. F9 — WCAG AA. daisyUI treats the semantic colours as fills, so using one as text ("Docker isolation disabled" on its own tinted chip) measured 1.28:1, and white-on-primary was 4.13:1 in BOTH themes, i.e. every filled primary button in the app. Adds a parallel --tone-* ramp for text/link/outline usage, nudges the few fill/content pairs that failed on their own (primary, corporate success/info/accent, dark secondary), replaces the sub-AA base-content alpha ramp with a --tone-muted colour, and gives coloured alerts on-colour foregrounds (the `dig ` chip inside an error alert was 1.07:1). Values are computed, not eyeballed: utils/contrast.ts implements the CSS colour maths and the unit test resolves the shipped theme CSS and fails below 4.5:1. F14 — 390px. Alerts are grids that flow in columns, so the telemetry banner rendered as a ~10-character column ~440px tall; it now stacks below sm. The activity table folds its secondary columns and goes table-fixed on narrow viewports so Status — the column that says a call failed — stays on screen, and main gets min-h-0 so the footer stops overlapping the last row. F21 — Server Logs. mockup-code clipped every entry with no wrap and no scrollbar; entries now wrap, keep a monospace ramp with real line spacing and sit on a themed surface. F29 — adds a "System" theme that follows prefers-color-scheme, makes it the default, keeps explicit choices pinned and persisted, and groups the rest. F30 — accessible names for the controls that had none, aria-live + caption on the auto-refreshing activity table. F32 — the header search button stays enabled at rest (empty submit is a no-op). F35 — one date/time format, centralised in utils/datetime.ts, matching the YYYY-MM-DD HH:mm:ss the CLI already prints. F36 (this area) — aria-labels for the collapsed icon-only sidebar, tooltips on truncated tool descriptions, non-wrapping "View Activity"/"View All Servers". e2e/web-ui-sweep/visual-a11y-sweep.spec.ts makes all of this a regression net: it resolves colours through a canvas (theme tokens are oklch(), so an rgb() parse measures nothing at all) and asserts contrast, layout, accessible names, the live region and the theme resolution on the main screens in both themes. --- docs/development/web-ui-verification.md | 2 + e2e/web-ui-sweep/visual-a11y-sweep.spec.ts | 358 +++++++++++++++++++ frontend/src/App.vue | 7 +- frontend/src/assets/main.css | 183 ++++++++++ frontend/src/components/AddServerModal.vue | 2 +- frontend/src/components/OnboardingWizard.vue | 1 + frontend/src/components/ProfileSwitcher.vue | 12 +- frontend/src/components/ServerCard.vue | 8 +- frontend/src/components/SidebarNav.vue | 50 ++- frontend/src/components/TelemetryBanner.vue | 15 +- frontend/src/components/TopHeader.vue | 44 ++- frontend/src/stores/system.ts | 91 ++++- frontend/src/utils/activity.ts | 13 +- frontend/src/utils/contrast.ts | 149 ++++++++ frontend/src/utils/datetime.ts | 76 ++++ frontend/src/views/Activity.vue | 128 +++++-- frontend/src/views/AgentTokens.vue | 10 +- frontend/src/views/Dashboard.vue | 41 ++- frontend/src/views/ScanReport.vue | 5 +- frontend/src/views/ServerDetail.vue | 40 ++- frontend/src/views/Servers.vue | 6 +- frontend/src/views/Sessions.vue | 9 +- frontend/src/views/Tools.vue | 22 +- frontend/tests/unit/contrast.spec.ts | 192 ++++++++++ frontend/tests/unit/datetime.spec.ts | 60 ++++ frontend/tests/unit/theme-system.spec.ts | 131 +++++++ 26 files changed, 1512 insertions(+), 143 deletions(-) create mode 100644 e2e/web-ui-sweep/visual-a11y-sweep.spec.ts create mode 100644 frontend/src/utils/contrast.ts create mode 100644 frontend/src/utils/datetime.ts create mode 100644 frontend/tests/unit/contrast.spec.ts create mode 100644 frontend/tests/unit/datetime.spec.ts create mode 100644 frontend/tests/unit/theme-system.spec.ts diff --git a/docs/development/web-ui-verification.md b/docs/development/web-ui-verification.md index 1925e5e9b..9e91f458b 100644 --- a/docs/development/web-ui-verification.md +++ b/docs/development/web-ui-verification.md @@ -18,6 +18,8 @@ The core-screen sweep is committed and scripted — run it before you hand-roll The launcher builds `./mcpproxy` if needed, serves a throwaway instance on `127.0.0.1:18080` under a freshly generated throwaway API key (your own `MCPPROXY_API_KEY` is deliberately ignored — the key ends up in report URLs and traces), installs Chromium from the committed `e2e/web-ui-sweep/package-lock.json` via `npm ci`, and runs [`e2e/web-ui-sweep/web-ui-sweep.spec.ts`](https://github.com/smart-mcp-proxy/mcpproxy-go/blob/main/e2e/web-ui-sweep/web-ui-sweep.spec.ts) — servers list, server detail (+ security tab), tools page and search, activity log, settings — failing on uncaught page exceptions. Pass `MCPPROXY_FIXTURE_PATH=$(go build -o /tmp/mcpfixture ./cmd/mcpfixture && echo /tmp/mcpfixture)` to register a live stdio upstream so the server- and tool-dependent checks run instead of skipping. The HTML report lands in `tmp/web-smoke-artifacts/playwright-report/`. +Alongside it, [`e2e/web-ui-sweep/visual-a11y-sweep.spec.ts`](https://github.com/smart-mcp-proxy/mcpproxy-go/blob/main/e2e/web-ui-sweep/visual-a11y-sweep.spec.ts) guards the *appearance* contract that the 2026-08 UX audit found broken: it walks every visible text node on the main screens in both shipped themes, resolves the effective foreground/background through a canvas (theme tokens are `oklch()`, so a naive `rgb()` parse silently measures nothing) and fails anything below WCAG AA; it also checks the 390/820/1440px layouts, accessible names on every form control, the activity log's `aria-live` region and caption, the system-theme resolution, and that the header search button is not disabled at rest. Same launcher, same environment variables. + The release QA gate runs this exact script on every tag as its **advisory** `web-ui-sweep` job — see [Release Gate](release-gate.md#web-ui-sweep-t2--advisory). Extend the committed sweep when you add a screen worth guarding on releases; use the ad-hoc pattern below for the deeper, spec-specific verification that ships beside a spec. ## Ad-hoc, spec-specific verification diff --git a/e2e/web-ui-sweep/visual-a11y-sweep.spec.ts b/e2e/web-ui-sweep/visual-a11y-sweep.spec.ts new file mode 100644 index 000000000..08cb1ee23 --- /dev/null +++ b/e2e/web-ui-sweep/visual-a11y-sweep.spec.ts @@ -0,0 +1,358 @@ +// Visual / accessibility sweep — the regression net for the 2026-08 UX audit +// findings F9 (WCAG AA contrast), F14 (390px layout), F30 (accessible names, +// aria-live, table caption), F29 (system theme) and F32 (header search). +// +// It runs against the Web UI served by a REAL mcpproxy binary, exactly like +// web-ui-sweep.spec.ts, and it MEASURES rather than eyeballs: every visible +// text node is resolved to its effective foreground/background (walking up +// through transparent ancestors and applying opacity) and scored with the WCAG +// 2.1 contrast formula, the same method the audit used. +// +// Launcher: scripts/run-web-smoke.sh (see docs/development/web-ui-verification.md). +import { test, expect, Page } from '@playwright/test' + +const BASE = process.env.MCPPROXY_BASE_URL || 'http://127.0.0.1:18080' +const KEY = process.env.MCPPROXY_API_KEY || '' + +/** Themes the app ships as its light/dark defaults; `system` resolves to one. */ +const THEMES = ['corporate', 'dark'] as const + +const VIEWPORTS = [ + { name: 'desktop', width: 1440, height: 900 }, + { name: 'tablet', width: 820, height: 1180 }, + { name: 'mobile', width: 390, height: 844 }, +] as const + +const ROUTES = ['/', '/servers', '/activity', '/tools', '/sessions'] as const + +function url(route: string): string { + const sep = route.includes('?') ? '&' : '?' + return KEY ? `${BASE}/ui${route}${sep}apikey=${encodeURIComponent(KEY)}` : `${BASE}/ui${route}` +} + +async function goto(page: Page, route: string, theme?: string) { + if (theme) { + await page.addInitScript((t) => { + window.localStorage.setItem('mcpproxy-theme', t) + }, theme) + } + await page.goto(url(route)) + await page.waitForLoadState('domcontentloaded') + const closeWizard = page.locator('[data-test="close-wizard"]') + if (await closeWizard.isVisible().catch(() => false)) { + await closeWizard.click() + } + await page.locator('main').first().waitFor({ state: 'visible' }) + // Give SSE-driven content one tick to paint. + await page.waitForTimeout(750) +} + +interface ContrastFailure { + text: string + ratio: number + fg: string + bg: string + selector: string +} + +/** + * Walk every visible text node, resolve its effective colours and return the + * ones below the WCAG AA threshold for their size. + */ +async function contrastFailures(page: Page): Promise { + return page.evaluate(() => { + // Computed styles come back in the syntax they were authored in — the + // daisyUI themes are `oklch()`, and Chromium keeps them that way — so the + // only reliable reader is the browser's own colour pipeline. Painting the + // value onto a 1x1 canvas gives the sRGB bytes a user actually sees, which + // is exactly how the audit sampled its numbers. + const canvas = document.createElement('canvas') + canvas.width = canvas.height = 1 + const ctx = canvas.getContext('2d', { willReadFrequently: true })! + const cache = new Map() + const parse = (value: string): [number, number, number, number] => { + const hit = cache.get(value) + if (hit) return hit + ctx.clearRect(0, 0, 1, 1) + ctx.fillStyle = '#000000' + ctx.fillStyle = value + // An unparseable value leaves fillStyle at the previous colour; treat a + // literal `transparent` as fully transparent rather than opaque black. + if (/^(transparent|rgba?\(0,\s*0,\s*0,\s*0\))$/i.test(value.trim())) { + const clear: [number, number, number, number] = [0, 0, 0, 0] + cache.set(value, clear) + return clear + } + ctx.fillRect(0, 0, 1, 1) + const d = ctx.getImageData(0, 0, 1, 1).data + const out: [number, number, number, number] = [d[0], d[1], d[2], d[3] / 255] + cache.set(value, out) + return out + } + const lum = ([r, g, b]: number[]) => { + const f = (c: number) => { + const v = c / 255 + return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4) + } + return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b) + } + const ratio = (a: number[], b: number[]) => { + const [hi, lo] = lum(a) >= lum(b) ? [lum(a), lum(b)] : [lum(b), lum(a)] + return (hi + 0.05) / (lo + 0.05) + } + const over = (fg: number[], alpha: number, bg: number[]) => + [0, 1, 2].map((i) => fg[i] * alpha + bg[i] * (1 - alpha)) + + /** Composite every non-opaque background from the element up to . */ + const effectiveBackground = (el: Element): number[] => { + const stack: Array<[number[], number]> = [] + let node: Element | null = el + while (node) { + const cs = getComputedStyle(node) + const [r, g, b, a] = parse(cs.backgroundColor) + const alpha = a * Number(cs.opacity || '1') + if (alpha > 0) stack.push([[r, g, b], alpha]) + if (alpha >= 1) break + node = node.parentElement + } + let base = [255, 255, 255] + for (let i = stack.length - 1; i >= 0; i--) { + base = over(stack[i][0], stack[i][1], base) + } + return base + } + + const cumulativeOpacity = (el: Element): number => { + let o = 1 + let node: Element | null = el + while (node) { + o *= Number(getComputedStyle(node).opacity || '1') + node = node.parentElement + } + return o + } + + const describe = (el: Element): string => { + const cls = (el.className || '').toString().split(/\s+/).filter(Boolean).slice(0, 4) + return `${el.tagName.toLowerCase()}${cls.length ? '.' + cls.join('.') : ''}` + } + + const failures: Array<{ + text: string + ratio: number + fg: string + bg: string + selector: string + }> = [] + const seen = new Set() + + const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT) + let node: Node | null + while ((node = walker.nextNode())) { + const text = (node.textContent || '').trim() + if (!text) continue + const el = node.parentElement + if (!el || seen.has(el)) continue + seen.add(el) + // WCAG 1.4.3 exempts disabled controls and purely decorative text. + if ( + el.closest( + 'script, style, svg, [aria-hidden="true"], .sr-only, [disabled], .btn-disabled, .tab-disabled', + ) + ) { + continue + } + + const rect = el.getBoundingClientRect() + if (rect.width < 2 || rect.height < 2) continue + const cs = getComputedStyle(el) + if (cs.visibility === 'hidden' || cs.display === 'none') continue + + const [r, g, b, a] = parse(cs.color) + const alpha = a * cumulativeOpacity(el) + if (alpha <= 0.05) continue + const bg = effectiveBackground(el) + const fg = over([r, g, b], alpha, bg) + + const size = parseFloat(cs.fontSize) + const weight = Number(cs.fontWeight) || 400 + const large = size >= 24 || (size >= 18.66 && weight >= 700) + const threshold = large ? 3 : 4.5 + + const value = ratio(fg, bg) + if (value + 0.005 < threshold) { + failures.push({ + text: text.slice(0, 70), + ratio: Math.round(value * 100) / 100, + fg: `rgb(${fg.map((c) => Math.round(c)).join(' ')})`, + bg: `rgb(${bg.map((c) => Math.round(c)).join(' ')})`, + selector: describe(el), + }) + } + } + return failures + }) +} + +// --------------------------------------------------------------------------- +// F9 — WCAG AA contrast on every main screen, in both shipped themes. +// --------------------------------------------------------------------------- +for (const theme of THEMES) { + for (const route of ROUTES) { + test(`contrast AA: ${route} (${theme})`, async ({ page }) => { + await goto(page, route, theme) + const failures = await contrastFailures(page) + expect( + failures, + `WCAG AA contrast failures on ${route} (${theme}):\n` + + failures + .map((f) => ` ${f.ratio}:1 ${f.selector} ${f.fg} on ${f.bg} "${f.text}"`) + .join('\n'), + ).toEqual([]) + }) + } +} + +test('contrast AA: filled primary buttons in both themes', async ({ page }) => { + for (const theme of THEMES) { + await goto(page, '/servers', theme) + const failures = (await contrastFailures(page)).filter((f) => + f.selector.includes('btn-primary'), + ) + expect(failures, `primary button contrast in ${theme}`).toEqual([]) + } +}) + +// --------------------------------------------------------------------------- +// F29 — "match system" theme. +// --------------------------------------------------------------------------- +test('system theme follows the OS colour scheme', async ({ browser }) => { + const dark = await browser.newPage({ colorScheme: 'dark' }) + await dark.goto(url('/')) + await dark.waitForLoadState('domcontentloaded') + await expect + .poll(() => dark.evaluate(() => document.documentElement.getAttribute('data-theme'))) + .toBe('dark') + await dark.close() + + const light = await browser.newPage({ colorScheme: 'light' }) + await light.goto(url('/')) + await light.waitForLoadState('domcontentloaded') + await expect + .poll(() => light.evaluate(() => document.documentElement.getAttribute('data-theme'))) + .toBe('corporate') + await light.close() +}) + +test('an explicit theme choice survives the OS preference', async ({ browser }) => { + const page = await browser.newPage({ colorScheme: 'dark' }) + await page.addInitScript(() => window.localStorage.setItem('mcpproxy-theme', 'corporate')) + await page.goto(url('/')) + await page.waitForLoadState('domcontentloaded') + await expect + .poll(() => page.evaluate(() => document.documentElement.getAttribute('data-theme'))) + .toBe('corporate') + await page.close() +}) + +// --------------------------------------------------------------------------- +// F14 — 390px layout: nothing clips, no horizontal page scroll, Status visible. +// --------------------------------------------------------------------------- +for (const vp of VIEWPORTS) { + test(`layout holds at ${vp.width}px (${vp.name})`, async ({ page }) => { + await page.setViewportSize({ width: vp.width, height: vp.height }) + for (const route of ROUTES) { + await goto(page, route) + const overflow = await page.evaluate( + () => document.documentElement.scrollWidth - document.documentElement.clientWidth, + ) + expect(overflow, `horizontal page overflow on ${route} at ${vp.width}px`).toBeLessThanOrEqual(1) + } + }) +} + +test('activity keeps the Status column on a phone', async ({ page }) => { + await page.setViewportSize({ width: 390, height: 844 }) + await goto(page, '/activity') + const rows = page.locator('[data-test="activity-row"]') + if ((await rows.count()) === 0) test.skip(true, 'no activity records on this instance') + const status = rows.first().locator('[data-test="activity-status"]') + await expect(status).toBeVisible() + const box = await status.boundingBox() + expect(box, 'status cell has no box').not.toBeNull() + expect(box!.x + box!.width, 'Status column is clipped off the right edge').toBeLessThanOrEqual(390) + // …and the label itself must not be cut off inside its own cell. + const clipped = await status.evaluate((el) => { + const cell = el.closest('td')! + return cell.scrollWidth - cell.clientWidth + }) + expect(clipped, 'Status label is clipped inside its cell').toBeLessThanOrEqual(1) +}) + +test('the footer never overlaps the page content', async ({ page }) => { + await page.setViewportSize({ width: 390, height: 844 }) + await goto(page, '/activity') + const overlap = await page.evaluate(() => { + const footer = document.querySelector('footer') + const main = document.querySelector('main') + if (!footer || !main) return 0 + return main.getBoundingClientRect().bottom - footer.getBoundingClientRect().top + }) + expect(overlap, 'main content bleeds under the footer').toBeLessThanOrEqual(1) +}) + +// --------------------------------------------------------------------------- +// F30 — accessible names, live region, table caption. +// --------------------------------------------------------------------------- +test('every form control on the main screens has an accessible name', async ({ page }) => { + for (const route of ROUTES) { + await goto(page, route) + const unnamed = await page.evaluate(() => { + const out: string[] = [] + const controls = document.querySelectorAll('input, select, textarea') + controls.forEach((el) => { + const c = el as HTMLInputElement + if (c.type === 'hidden') return + const rect = c.getBoundingClientRect() + if (rect.width < 2 || rect.height < 2) return + const labelled = + c.getAttribute('aria-label') || + c.getAttribute('aria-labelledby') || + c.getAttribute('placeholder') || + c.getAttribute('title') || + (c.id && document.querySelector(`label[for="${CSS.escape(c.id)}"]`)) || + c.closest('label') + if (!labelled) { + out.push(`${c.tagName.toLowerCase()}[type=${c.type}] .${c.className}`) + } + }) + return out + }) + expect(unnamed, `unnamed form controls on ${route}`).toEqual([]) + } +}) + +test('the activity table announces updates and carries a caption', async ({ page }) => { + await goto(page, '/activity') + await expect(page.locator('[data-test="activity-live-region"]')).toHaveCount(1) + await expect(page.locator('[data-test="activity-live-region"]')).toHaveAttribute( + 'aria-live', + 'polite', + ) + const captions = await page.locator('table caption').count() + expect(captions, 'activity table has no ').toBeGreaterThan(0) +}) + +// --------------------------------------------------------------------------- +// F32 — the header search must not read as disabled at rest. +// --------------------------------------------------------------------------- +test('header search button is enabled with an empty box', async ({ page }) => { + await goto(page, '/') + const button = page.locator('[data-test="header-search-button"]') + await expect(button).toBeEnabled() + await expect(page.locator('[data-test="header-search-input"]')).toHaveValue('') + // Clicking with an empty query is a no-op, not a navigation. + await button.click() + await page.waitForTimeout(250) + expect(page.url()).not.toContain('/search') +}) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 1d23fbf6b..677ed3b3f 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -12,8 +12,11 @@ - -
+ +
diff --git a/frontend/src/assets/main.css b/frontend/src/assets/main.css index 03130b052..08f9b6aa2 100644 --- a/frontend/src/assets/main.css +++ b/frontend/src/assets/main.css @@ -10,6 +10,189 @@ coffee, winter, dim, nord, sunset; } +/* + * --------------------------------------------------------------------------- + * WCAG AA contrast tokens (UX audit F9) + * --------------------------------------------------------------------------- + * Two problems the stock daisyUI palettes have, both measured on a live page: + * + * 1. Semantic colours are *fills*, not text colours. `text-warning` on a + * `bg-warning/10` chip resolved to 1.28:1 in `corporate` — the worst + * offender was the "Docker isolation disabled" security warning itself. + * Fix: a parallel `--tone-*` ramp, dark enough (light themes) or light + * enough (dark themes) to clear 4.5:1 on base-100/200/300 and on their + * 10% tints. Only `text-*` / `link-*` are remapped; fills keep their token. + * + * 2. A few fill/content pairs fail on their own: white on `primary` was + * 4.13:1 in BOTH shipped themes (every filled primary button in the app), + * and white on corporate `success`/`info` was 3.30/3.73:1. Fix: one step + * darker on the fill, which buys AA everywhere those tokens are used. + * + * The values below are computed, not eyeballed: `frontend/src/utils/contrast.ts` + * implements the CSS colour maths and `frontend/tests/unit/contrast.spec.ts` + * parses THIS file plus the daisyUI theme files and fails if any audited pair + * drops below AA. Chroma/hue are preserved from the upstream token so the + * themes still look like themselves; only lightness moves. + */ +:root { + /* Generic fallback for the 13 non-default themes: bend the semantic colour + toward the theme's own text colour, which always increases contrast with + the theme's own surfaces regardless of whether the theme is light or dark. */ + --tone-primary: color-mix(in oklab, var(--color-primary) 62%, var(--color-base-content)); + --tone-secondary: color-mix(in oklab, var(--color-secondary) 62%, var(--color-base-content)); + --tone-accent: color-mix(in oklab, var(--color-accent) 62%, var(--color-base-content)); + --tone-info: color-mix(in oklab, var(--color-info) 62%, var(--color-base-content)); + --tone-success: color-mix(in oklab, var(--color-success) 62%, var(--color-base-content)); + --tone-warning: color-mix(in oklab, var(--color-warning) 62%, var(--color-base-content)); + --tone-error: color-mix(in oklab, var(--color-error) 62%, var(--color-base-content)); + /* Secondary/muted body text. `text-base-content/40` resolved to 2.51:1 on + white — AA has no "this text is less important" exemption, so the muted + ramp is a colour, not an alpha. */ + --tone-muted: color-mix(in oklab, var(--color-base-content) 78%, var(--color-base-100)); +} + +/* Light default. Worst-case ratios after the change are in the spec file. */ +[data-theme="corporate"] { + --color-primary: oklch(55% 0.158 241.966); /* white on primary 4.14 -> 4.66 */ + --color-success: oklch(53% 0.194 149.214); /* white on success 3.30 -> 4.66 */ + --color-info: oklch(54% 0.126 221.723); /* white on info 3.73 -> 4.70 */ + --color-accent: oklch(54% 0.118 184.704); /* white on accent 3.66 -> 4.61 */ + --color-secondary: oklch(46% 0.046 257.417); /* outline secondary 3.94 -> 5.79 */ + --tone-primary: oklch(42% 0.158 241.966); + --tone-secondary: oklch(43% 0.046 257.417); + --tone-accent: oklch(40% 0.118 184.704); + --tone-info: oklch(41% 0.126 221.723); + --tone-success: oklch(39% 0.194 149.214); + --tone-warning: oklch(45% 0.199 91.936); + --tone-error: oklch(46% 0.191 22.216); + --tone-muted: oklch(46% 0.031 278.072); /* base-content/40 2.51 -> 4.68 */ +} + +/* Dark default. */ +[data-theme="dark"] { + --color-primary: oklch(55% 0.233 277.117); /* primary-content on primary 4.14 -> 4.71 */ + --color-secondary: oklch(53% 0.241 354.308); /* secondary-content on secondary 3.05 -> 4.69 */ + --tone-primary: oklch(70% 0.233 277.117); + --tone-secondary: oklch(71% 0.241 354.308); + --tone-accent: oklch(66% 0.152 181.912); + --tone-info: oklch(67% 0.16 232.661); + --tone-success: oklch(66% 0.177 163.223); + --tone-warning: oklch(70% 0.189 84.429); + --tone-error: oklch(70% 0.194 13.428); + --tone-muted: oklch(64% 0.029 256.847); /* base-content/40 3.56 -> 4.71 */ +} + +@layer utilities { + /* Semantic text/link colours read from the AA-checked ramp. Fills + (`bg-*`, `badge-*`, `btn-*`, `alert-*`) deliberately keep `--color-*`. */ + .text-primary { color: var(--tone-primary); } + .text-secondary { color: var(--tone-secondary); } + .text-accent { color: var(--tone-accent); } + .text-info { color: var(--tone-info); } + .text-success { color: var(--tone-success); } + .text-warning { color: var(--tone-warning); } + .text-error { color: var(--tone-error); } + + .link-primary { color: var(--tone-primary); } + .link-secondary { color: var(--tone-secondary); } + .link-accent { color: var(--tone-accent); } + .link-info { color: var(--tone-info); } + .link-success { color: var(--tone-success); } + .link-warning { color: var(--tone-warning); } + .link-error { color: var(--tone-error); } + + /* Faded body text: the alpha ramp below /80 never cleared AA on any surface, + so every step of it resolves to the muted colour instead. */ + .text-base-content\/30, + .text-base-content\/40, + .text-base-content\/50, + .text-base-content\/60, + .text-base-content\/70 { + color: var(--tone-muted); + } +} + +/* + * Unfilled variants paint the semantic colour as TEXT on a base surface, which + * is the same failure mode as `text-*` (a dark-theme outline secondary button + * measured 2.96:1). daisyUI exposes `--btn-rest-fg` for exactly this: it is + * read only in the rest state, so hover still flips to the filled fg/bg pair. + */ +:where(.btn-outline, .btn-dash, .btn-soft, .btn-ghost, .btn-link) { + &.btn-primary { --btn-rest-fg: var(--tone-primary); } + &.btn-secondary { --btn-rest-fg: var(--tone-secondary); } + &.btn-accent { --btn-rest-fg: var(--tone-accent); } + &.btn-info { --btn-rest-fg: var(--tone-info); } + &.btn-success { --btn-rest-fg: var(--tone-success); } + &.btn-warning { --btn-rest-fg: var(--tone-warning); } + &.btn-error { --btn-rest-fg: var(--tone-error); } +} + +:where(.badge-outline, .badge-dash, .badge-soft) { + &.badge-primary { color: var(--tone-primary); } + &.badge-secondary { color: var(--tone-secondary); } + &.badge-accent { color: var(--tone-accent); } + &.badge-info { color: var(--tone-info); } + &.badge-success { color: var(--tone-success); } + &.badge-warning { color: var(--tone-warning); } + &.badge-error { color: var(--tone-error); } +} + +/* daisyUI paints these with `opacity` on base-content, which lands at ~4.2:1 + in corporate and ~3.6:1 in dark. Same intent, AA-checked colour instead. */ +.stat-title, +.stat-desc { + color: var(--tone-muted); + opacity: 1; +} + +.tabs .tab:not(.tab-active):not(.tab-disabled) { + color: var(--tone-muted); + opacity: 1; +} + +/* + * Inside a COLOURED alert the background is the semantic fill, so any tinted + * foreground on top of it is unreadable by construction: the audit measured + * 1.07:1 for the `dig ` remediation chip and 1.41:1 for the docs link. + * On such a surface the only guaranteed-AA foreground is the theme's own + * `*-content` colour, so links, ghost buttons and semantic text utilities all + * inherit it, and code chips invert into it. Unlayered so it beats daisyUI. + * Neutral `.alert` (base-200 surface) is untouched — tones are readable there. + */ +.alert-info { --alert-fg: var(--color-info-content); } +.alert-success { --alert-fg: var(--color-success-content); } +.alert-warning { --alert-fg: var(--color-warning-content); } +.alert-error { --alert-fg: var(--color-error-content); } + +/* `:not(.btn)` matters: a FILLED button inside an alert brings its own + background, so forcing the alert's foreground onto it would drop it to + 1.8:1 — the alert's rules apply to text, links and transparent buttons. */ +:where(.alert-info, .alert-success, .alert-warning, .alert-error) + :where(a:not(.btn), .link:not(.btn), .link-primary:not(.btn), .link-info:not(.btn), + .link-success:not(.btn), .link-warning:not(.btn), .link-error:not(.btn), + .btn-ghost, .btn-link, + .text-primary:not(.btn), .text-secondary:not(.btn), .text-accent:not(.btn), + .text-info:not(.btn), .text-success:not(.btn), .text-warning:not(.btn), + .text-error:not(.btn), .text-base-content\/30, .text-base-content\/40, + .text-base-content\/50, .text-base-content\/60, .text-base-content\/70) { + color: var(--alert-fg); + --btn-rest-fg: var(--alert-fg); +} + +:where(.alert-info, .alert-success, .alert-warning, .alert-error) + :where(a:not(.btn), .link:not(.btn)) { + text-decoration-line: underline; +} + +/* Code chips on a coloured alert: invert to the alert's own fill/content pair, + which every theme guarantees to be legible (>= 4.5:1 after the token fixes). */ +:where(.alert-info, .alert-success, .alert-warning, .alert-error) :where(code, kbd) { + background-color: var(--alert-fg); + color: var(--alert-color, var(--color-base-200)); + border-color: transparent; +} + /* Prevent horizontal scroll globally */ html, body { diff --git a/frontend/src/components/AddServerModal.vue b/frontend/src/components/AddServerModal.vue index 471090b89..af41b8d1f 100644 --- a/frontend/src/components/AddServerModal.vue +++ b/frontend/src/components/AddServerModal.vue @@ -87,7 +87,7 @@ - diff --git a/frontend/src/components/OnboardingWizard.vue b/frontend/src/components/OnboardingWizard.vue index 24b51ea8a..bf806ed5b 100644 --- a/frontend/src/components/OnboardingWizard.vue +++ b/frontend/src/components/OnboardingWizard.vue @@ -171,6 +171,7 @@ - Profile: + Profile: {{ activeLabel }} -
Active profile
+
Active profile