Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: announce the Digital Twin confidence gauge as an ARIA meter (#3924)

[._.]/ Adam Eivy72cc7638e265
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index d7621b6f21..2bc8c2451b 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -66,3 +66,4 @@
- `docs/SELF_UPDATE.md` now documents that `update.sh` / `update.ps1` check out `main` before pulling, stashing a dirty working tree first so the checkout can proceed. The doc described only the `git pull --rebase --autostash`, so anyone running an in-app or CLI update from a feature branch or a detached HEAD was surprised to find their checkout moved to `main` with their work parked in `git stash` — the scripts print the restore commands on completion, but nothing said so up front.
- The Vite dev server example in `docs/PM2.md` no longer tells you to point PM2 at `node_modules/.bin/vite`. PM2 resolves a relative `script` against its own working directory rather than the app's `cwd`, and the `.bin` entry itself varies by platform and package manager (symlink, `.cmd`/`.ps1` wrapper, generated shell script), none of which the Node interpreter launches uniformly — so a config copy-pasted from the doc crashed on startup. Both the standalone snippet and the complete monorepo example now use the absolute `path.join(__dirname, 'client', 'node_modules', 'vite', 'bin', 'vite.js')` form that PortOS's own `portos-ui` app has always used, with a note explaining why.
- A failed URL import in the SongBook importer no longer leaves the form looking untouched. The error had only a transient toast behind it, so once it faded the URL still sat in the input with no preview, no explanation, and a Save button that answered with the unrelated "Nothing to save — paste or fetch a tab first". The From URL tab now keeps an inline alert under the input naming the failure with a Retry button next to it, clears that alert as soon as the URL is edited, and drops any previously fetched draft (and the title/artist it auto-filled) so a failed fetch can't leave the earlier song previewed under a URL that never loaded. The disabled Save button now says why it's disabled instead of waiting for the click. A result that lands after the URL has been edited (or after the user has left the tab) is discarded rather than written under whatever is on screen now.
+- The Digital Twin confidence gauge is now announced to screen readers. The circular SVG ring and the per-dimension bars beneath it were plain `<div>`s with a decorative SVG inside, so assistive tech either skipped them or read the loose "72%" text node with nothing to say what it measured. The overall gauge now carries `role="meter"` with `aria-label="Digital Twin overall confidence"`, the min/max/now values, and an `aria-valuetext` pairing the percentage with its Strong/Moderate/Needs Work band; each dimension bar carries the same meter semantics under its own dimension label, and the ring SVG is marked `aria-hidden` so its geometry isn't read twice.
diff --git a/client/src/components/digital-twin/ConfidenceGauge.jsx b/client/src/components/digital-twin/ConfidenceGauge.jsx
index eb6ad6f0a1..0c7dba36bd 100644
--- a/client/src/components/digital-twin/ConfidenceGauge.jsx
+++ b/client/src/components/digital-twin/ConfidenceGauge.jsx
@@ -93,8 +93,16 @@ export default function ConfidenceGauge({ confidence, onRecalculate }) {
{/* Overall Score */}
<div className="flex items-center gap-6 mb-6">
- <div className="relative w-24 h-24 shrink-0">
- <svg className="w-full h-full transform -rotate-90" viewBox="0 0 100 100">
+ <div
+ className="relative w-24 h-24 shrink-0"
+ role="meter"
+ aria-label="Digital Twin overall confidence"
+ aria-valuenow={Math.round(overall * 100)}
+ aria-valuemin={0}
+ aria-valuemax={100}
+ aria-valuetext={`${Math.round(overall * 100)}% — ${getConfidenceLabel(overall)}`}
+ >
+ <svg className="w-full h-full transform -rotate-90" viewBox="0 0 100 100" aria-hidden="true">
<circle
cx="50"
cy="50"
@@ -175,7 +183,14 @@ export default function ConfidenceGauge({ confidence, onRecalculate }) {
{Math.round(score * 100)}%
</span>
</div>
- <div className="h-1.5 bg-port-border rounded-full overflow-hidden mt-1">
+ <div
+ className="h-1.5 bg-port-border rounded-full overflow-hidden mt-1"
+ role="meter"
+ aria-label={`${label} confidence`}
+ aria-valuenow={Math.round(score * 100)}
+ aria-valuemin={0}
+ aria-valuemax={100}
+ >
<div
className={`h-full transition-all ${color.bg}`}
style={{ width: `${score * 100}%` }}
diff --git a/client/src/components/digital-twin/ConfidenceGauge.test.jsx b/client/src/components/digital-twin/ConfidenceGauge.test.jsx
new file mode 100644
index 0000000000..59596a4b69
--- /dev/null
+++ b/client/src/components/digital-twin/ConfidenceGauge.test.jsx
@@ -0,0 +1,37 @@
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen } from '@testing-library/react';
+
+import ConfidenceGauge from './ConfidenceGauge';
+
+vi.mock('../../services/api', () => ({ calculateDigitalTwinConfidence: vi.fn() }));
+vi.mock('../ui/Toast', () => ({ default: { error: vi.fn(), success: vi.fn() } }));
+
+const confidence = {
+ overall: 0.72,
+ dimensions: { openness: 0.9, boundaries: 0.4 }
+};
+
+describe('ConfidenceGauge accessibility', () => {
+ it('exposes the overall gauge as a meter carrying the percentage', () => {
+ render(<ConfidenceGauge confidence={confidence} />);
+
+ const gauge = screen.getByRole('meter', { name: 'Digital Twin overall confidence' });
+ expect(gauge).toHaveAttribute('aria-valuenow', '72');
+ expect(gauge).toHaveAttribute('aria-valuemin', '0');
+ expect(gauge).toHaveAttribute('aria-valuemax', '100');
+ expect(gauge.getAttribute('aria-valuetext')).toContain('72%');
+ });
+
+ it('exposes each dimension bar as its own labelled meter', () => {
+ render(<ConfidenceGauge confidence={confidence} />);
+
+ expect(screen.getByRole('meter', { name: 'Openness confidence' })).toHaveAttribute('aria-valuenow', '90');
+ expect(screen.getByRole('meter', { name: 'Boundaries confidence' })).toHaveAttribute('aria-valuenow', '40');
+ });
+
+ it('reports zero rather than a missing value when confidence is absent', () => {
+ render(<ConfidenceGauge confidence={null} />);
+
+ expect(screen.getByRole('meter', { name: 'Digital Twin overall confidence' })).toHaveAttribute('aria-valuenow', '0');
+ });
+});