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: keep accessible names visible for responsive-hidden control labels (#8118)

[._.]/ Adam Eivy62f7df1c0744
diff --git a/client/src/a11yConventions.test.js b/client/src/a11yConventions.test.js
index dd4905b91c..d42f606ef5 100644
--- a/client/src/a11yConventions.test.js
+++ b/client/src/a11yConventions.test.js
@@ -989,6 +989,74 @@ function hasUsableNativeInputName(tag) {
return type === 'image' && hasUsableAccessibleNameAttribute(tag, 'alt');
}
+// A `<span className="hidden sm:inline">Label</span>` genuinely leaves the
+// accessibility tree below `sm` — `display:none` content is excluded from
+// accessible-name computation — so a control whose ONLY text sits inside one
+// of these wrappers announces as a bare "button"/"link" at that width. The
+// fix keeps the text in the tree and hides it only visually
+// (`max-sm:sr-only` / `@max-xs:sr-only`, see ui/TabPills.jsx:172), which is
+// why a class carrying `sr-only` is never flagged even if it also carries a
+// bare `hidden` token (`sr-only sm:hidden`, the complementary half of the
+// same idiom).
+const RESPONSIVE_HIDDEN_DISPLAY_VARIANT = /^@?[\w.-]+:(?:inline-flex|inline|flex|block)$/;
+
+function isResponsiveHiddenLabelWrapper(tag) {
+ const cls = normalizedAttributeValue(attributeValue(tag, 'className')) ?? '';
+ const classes = cls.split(/\s+/).filter(Boolean);
+ if (!classes.includes('hidden') || classes.includes('sr-only')) return false;
+ return classes.some((token) => RESPONSIVE_HIDDEN_DISPLAY_VARIANT.test(token));
+}
+
+// Same shape as `stripHiddenElementContent` (blank the whole element — both
+// tags and its body) but keyed on the responsive-hidden-label class pattern
+// instead of `hidden`/`aria-hidden` attributes.
+function stripResponsiveHiddenLabelContent(body) {
+ const spans = [];
+ for (const node of forEachOpeningTag(body, undefined, { startMode: 'jsx-text' })) {
+ if (!isResponsiveHiddenLabelWrapper(node.tag)) continue;
+ const end = node.selfClosing ? node.contentStart : node.matchingClose?.contentStart;
+ if (end !== undefined) spans.push({ start: node.index, end });
+ }
+ return blankSourceSpans(body, spans);
+}
+
+// The static-text-or-usable-expression check `hasUsableElementText` ends
+// with, factored out so `isResponsiveHiddenOnlyLabelControl` can run it twice
+// — once over the body with responsive-hidden wrappers blanked out (is there
+// a name that survives at every width?), once over the untouched body (is
+// there a name here at all, so a genuinely empty/icon-only control is left to
+// the rule that already owns it?).
+function bodyHasUsableText(body) {
+ if (!body) return false;
+ const staticText = body.replace(/\{[^{}]*\}/g, ' ').trim();
+ if (staticText) return true;
+ return [...body.matchAll(/\{([^{}]*)\}/g)].some(([, expression]) => (
+ isUsableLabelAttributeValue(normalizedAttributeValue(expression))
+ ));
+}
+
+// No aria-label/aria-labelledby, and every text node inside sits under a
+// `hidden <variant>:inline` (or `@<size>:…`) wrapper rather than the
+// `max-<bp>:sr-only` fix form — so the control's name disappears exactly
+// where that wrapper hides it.
+function isResponsiveHiddenOnlyLabelControl(src, node) {
+ if (/\baria-label\s*=/.test(node.tag) || /\baria-labelledby\s*=/.test(node.tag)) return false;
+ if (node.selfClosing) return false;
+ const closing = node.matchingClose;
+ if (!closing) return false;
+ const rawBody = maskComments(src.slice(node.contentStart, closing.index), { startMode: 'jsx-text' });
+ const withoutA11yHidden = stripHiddenElementContent(rawBody);
+ // Any text left once the responsive-hidden wrappers are ALSO blanked is
+ // visible at every width, so the control is never nameless.
+ const alwaysVisibleBody = stripJsxTags(stripResponsiveHiddenLabelContent(withoutA11yHidden)).trim();
+ if (bodyHasUsableText(alwaysVisibleBody)) return false;
+ // Nothing survives — flag it only if that's because a responsive-hidden
+ // wrapper swallowed real text, not because the control had none to begin
+ // with (that shape is `isUnnamedIconOnlyButton`'s to catch).
+ const fullBody = stripJsxTags(withoutA11yHidden).trim();
+ return bodyHasUsableText(fullBody);
+}
+
// A FormField's only child is often a conditional rather than the control
// itself (`{field.type === 'select' ? <select/> : <input/>}`). React still
// clones the id onto whichever branch renders, because Children.map sees the
@@ -2292,6 +2360,101 @@ describe('a11y conventions', () => {
expect(offenders, `Icon-only <button> with no aria-label/aria-labelledby — title alone isn't touch-discoverable and isn't reliably read as the accessible name; see media/MediaCard.jsx's Annotate button for the convention:\n${offenders.join('\n')}`).toEqual([]);
});
+ // Pre-existing sites that use the same `hidden <bp>:inline` idiom for a
+ // control whose accessible name comes only from `title` (never
+ // aria-label). #8118 fixed the 14 sites its live-accessibility-tree audit
+ // found genuinely nameless; these carry the identical static shape but
+ // were out of that issue's audited scope. Tracked as a follow-up rather
+ // than silently reopening the scope of #8118 — see #8141. Fix by
+ // converting to `max-<bp>:sr-only` / `@max-<size>:sr-only` (or adding a
+ // real aria-label) and removing the entry.
+ const RESPONSIVE_HIDDEN_LABEL_ALLOWLIST = new Set([
+ 'src/pages/MediaAnnotate.jsx',
+ 'src/pages/Shell.jsx',
+ 'src/components/shell/ItermShellView.jsx',
+ 'src/components/shell/TerminalHotKeys.jsx',
+ 'src/components/shell/ShellProviderLauncher.jsx',
+ 'src/components/shell/ShellImageDrop.jsx',
+ 'src/components/songs/RoundSheetMusic.jsx',
+ 'src/components/songs/ScoreSheet.jsx',
+ 'src/components/goals/GoalsTreeView.jsx',
+ 'src/components/goals/GoalsListView.jsx',
+ 'src/components/writers-room/WorkEditor.jsx',
+ 'src/components/brain/tabs/DailyLogTab.jsx',
+ 'src/components/brain/tabs/FeedsTab.jsx',
+ 'src/components/brain/tabs/InboxTab.jsx',
+ 'src/components/brain/tabs/YoutubeTab.jsx',
+ 'src/components/fableloom/LoomPlayPanel.jsx',
+ 'src/components/apps/AppDetailView.jsx',
+ 'src/components/apps/tabs/GitTab.jsx',
+ 'src/components/dashboard/LayoutPicker.jsx',
+ 'src/pages/ProcessesPage.jsx',
+ 'src/pages/WritersRoom.jsx',
+ 'src/pages/FableLoomStory.jsx',
+ 'src/pages/AgentsPage.jsx',
+ 'src/pages/UsagePage.jsx',
+ 'src/pages/Eidoverse.jsx',
+ 'src/pages/CharacterSheet.jsx',
+ 'src/pages/VideoTimelineEditor.jsx',
+ 'src/pages/Brain.jsx',
+ 'src/components/dashboard/builtins/HourlyActivityWidget.jsx',
+ ]);
+
+ it('keeps a responsive-hidden control label in the accessible name', () => {
+ // A <button>/<a>/<Link> whose only text sits inside a `hidden
+ // sm:inline`/`hidden @xs:inline` span loses its name exactly where that
+ // wrapper hides it, because `display:none` content is excluded from
+ // accessible-name computation. Convert to `max-<bp>:sr-only` /
+ // `@max-<size>:sr-only` (ui/TabPills.jsx:172 is the existing convention)
+ // so the label stays in the tree and is hidden only visually.
+ const offenders = [];
+ for (const file of trackedJsxFiles()) {
+ if (RESPONSIVE_HIDDEN_LABEL_ALLOWLIST.has(file)) continue;
+ const src = rawSourceOf(file);
+ for (const tagName of ['button', 'a', 'Link']) {
+ for (const node of forEachOpeningTag(src, tagName)) {
+ if (!isResponsiveHiddenOnlyLabelControl(src, node)) continue;
+ offenders.push(`${file}:${lineOf(src, node.index)}`);
+ }
+ }
+ }
+ expect(offenders, `<button>/<a>/<Link> whose only accessible name is inside a "hidden <bp>:inline" (or "@<size>:…") span — convert to "max-<bp>:sr-only" / "@max-<size>:sr-only" so the label survives at every width (see ui/TabPills.jsx:172):\n${offenders.join('\n')}`).toEqual([]);
+ });
+
+ it('flags the hidden-label shape and passes the sr-only fix (#8118)', () => {
+ const failing = '<button><X /><span className="hidden sm:inline">Save</span></button>';
+ const [failingNode] = [...forEachOpeningTag(failing, 'button')];
+ expect(isResponsiveHiddenOnlyLabelControl(failing, failingNode)).toBe(true);
+
+ const passing = '<button><X /><span className="max-sm:sr-only">Save</span></button>';
+ const [passingNode] = [...forEachOpeningTag(passing, 'button')];
+ expect(isResponsiveHiddenOnlyLabelControl(passing, passingNode)).toBe(false);
+
+ // A control that also carries always-visible text keeps a name at every
+ // width, so it is not this bug (Catalog.jsx's `Remix<span className=
+ // "hidden sm:inline"> into…</span>`).
+ const mixedVisible = '<button>Remix<span className="hidden sm:inline"> into…</span></button>';
+ const [mixedNode] = [...forEachOpeningTag(mixedVisible, 'button')];
+ expect(isResponsiveHiddenOnlyLabelControl(mixedVisible, mixedNode)).toBe(false);
+
+ // A real aria-label exempts the control even though the text is hidden
+ // the same way.
+ const labeled = '<button aria-label="Save"><X /><span className="hidden sm:inline">Save</span></button>';
+ const [labeledNode] = [...forEachOpeningTag(labeled, 'button')];
+ expect(isResponsiveHiddenOnlyLabelControl(labeled, labeledNode)).toBe(false);
+
+ // A genuinely icon-only button (no text at all) is left to
+ // `isUnnamedIconOnlyButton`, not double-flagged here.
+ const iconOnly = '<button><X /></button>';
+ const [iconOnlyNode] = [...forEachOpeningTag(iconOnly, 'button')];
+ expect(isResponsiveHiddenOnlyLabelControl(iconOnly, iconOnlyNode)).toBe(false);
+
+ // The container-query variant follows the same rule.
+ const containerFailing = '<a href="/x"><X /><span className="hidden @xs:inline">Details</span></a>';
+ const [containerNode] = [...forEachOpeningTag(containerFailing, 'a')];
+ expect(isResponsiveHiddenOnlyLabelControl(containerFailing, containerNode)).toBe(true);
+ });
+
it('keyboard-activates every clickable non-interactive element', () => {
// Whole-tree scan (every tracked JSX file), so a contended full-suite
// worker can exceed the default 5s budget — runner budget, not product
diff --git a/client/src/components/BackupWidget.jsx b/client/src/components/BackupWidget.jsx
index 84414ccd8b..5837f29f32 100644
--- a/client/src/components/BackupWidget.jsx
+++ b/client/src/components/BackupWidget.jsx
@@ -406,7 +406,7 @@ const BackupWidget = memo(function BackupWidget() {
to="/settings"
className="flex shrink-0 items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
>
- <span className="hidden @xs:inline">Settings</span>
+ <span className="@max-xs:sr-only">Settings</span>
<ChevronRight size={16} />
</Link>
</div>
diff --git a/client/src/components/CosDashboardWidget.jsx b/client/src/components/CosDashboardWidget.jsx
index ff92a2027a..789a05beae 100644
--- a/client/src/components/CosDashboardWidget.jsx
+++ b/client/src/components/CosDashboardWidget.jsx
@@ -188,7 +188,7 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {
to="/cos/tasks"
className="flex shrink-0 items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
>
- <span className="hidden @xs:inline">View Details</span>
+ <span className="@max-xs:sr-only">View Details</span>
<ChevronRight size={16} />
</Link>
</div>
diff --git a/client/src/components/DecisionLogWidget.jsx b/client/src/components/DecisionLogWidget.jsx
index fb9001e059..20328152f9 100644
--- a/client/src/components/DecisionLogWidget.jsx
+++ b/client/src/components/DecisionLogWidget.jsx
@@ -259,7 +259,7 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {
to="/cos/learning"
className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
>
- <span className="hidden @xs:inline">Details</span>
+ <span className="@max-xs:sr-only">Details</span>
<ChevronRight size={16} />
</Link>
</div>
diff --git a/client/src/components/GoalProgressWidget.jsx b/client/src/components/GoalProgressWidget.jsx
index 8e5ef13a1b..5b0d52817c 100644
--- a/client/src/components/GoalProgressWidget.jsx
+++ b/client/src/components/GoalProgressWidget.jsx
@@ -96,7 +96,7 @@ const GoalProgressWidget = memo(function GoalProgressWidget() {
to="/goals"
className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
>
- <span className="hidden @xs:inline">View All</span>
+ <span className="@max-xs:sr-only">View All</span>
<ChevronRight size={16} />
</Link>
</div>
diff --git a/client/src/components/SystemHealthWidget.jsx b/client/src/components/SystemHealthWidget.jsx
index afc2510e91..9779088e9a 100644
--- a/client/src/components/SystemHealthWidget.jsx
+++ b/client/src/components/SystemHealthWidget.jsx
@@ -115,7 +115,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })
to="/system-resources/overview"
className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
>
- <span className="hidden @xs:inline">Details</span>
+ <span className="@max-xs:sr-only">Details</span>
<ChevronRight size={16} />
</Link>
</div>
diff --git a/client/src/components/UpcomingTasksWidget.jsx b/client/src/components/UpcomingTasksWidget.jsx
index 3655ed2a9c..f4c6de91ad 100644
--- a/client/src/components/UpcomingTasksWidget.jsx
+++ b/client/src/components/UpcomingTasksWidget.jsx
@@ -109,7 +109,7 @@ const UpcomingTasksWidget = memo(function UpcomingTasksWidget() {
to="/cos/schedule"
className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
>
- <span className="hidden @xs:inline">Schedule</span>
+ <span className="@max-xs:sr-only">Schedule</span>
<ChevronRight size={16} />
</Link>
</div>
diff --git a/client/src/components/WhileAwayWidget.jsx b/client/src/components/WhileAwayWidget.jsx
index 5eed913156..c2d407a655 100644
--- a/client/src/components/WhileAwayWidget.jsx
+++ b/client/src/components/WhileAwayWidget.jsx
@@ -139,7 +139,7 @@ export default function WhileAwayWidget() {
aria-label="Mark as seen — reset the window to now"
>
<Eye size={13} />
- <span className="hidden @sm:inline">Mark as seen</span>
+ <span className="@max-sm:sr-only">Mark as seen</span>
</button>
)}
</div>
diff --git a/client/src/components/apps/tabs/SubmodulesTab.jsx b/client/src/components/apps/tabs/SubmodulesTab.jsx
index 0f37ce27bd..5cb7b3faea 100644
--- a/client/src/components/apps/tabs/SubmodulesTab.jsx
+++ b/client/src/components/apps/tabs/SubmodulesTab.jsx
@@ -151,7 +151,7 @@ export default function SubmodulesTab({ repoPath }) {
className="px-3 sm:px-4 py-2 bg-port-card hover:bg-port-border text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 text-sm border border-port-border min-h-[40px]"
>
<RefreshCw size={16} className={refreshing ? 'animate-spin' : ''} />
- <span className="hidden sm:inline">Refresh</span>
+ <span className="max-sm:sr-only">Refresh</span>
</button>
</div>
</div>
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index 4ca4f97e65..f01568d2e9 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -1586,7 +1586,7 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
title="Save current form as a reusable template"
>
<Bookmark size={14} aria-hidden="true" />
- <span className="hidden @sm:inline">Save Template</span>
+ <span className="@max-sm:sr-only">Save Template</span>
</button>}
<button
onClick={handleAddTask}
diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsx
index 5ac55905e8..13515d89f7 100644
--- a/client/src/pages/Dashboard.jsx
+++ b/client/src/pages/Dashboard.jsx
@@ -466,7 +466,7 @@ export default function Dashboard() {
title="Reorder, move and resize widgets"
>
<Move size={14} />
- <span className="hidden sm:inline">Arrange</span>
+ <span className="max-sm:sr-only">Arrange</span>
</button>
)}
{editingGrid && (
@@ -477,7 +477,7 @@ export default function Dashboard() {
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-port-card border border-port-border hover:border-gray-600 transition-colors text-sm text-gray-400 hover:text-white min-h-[40px] disabled:opacity-50"
>
<X size={14} />
- <span className="hidden sm:inline">Cancel</span>
+ <span className="max-sm:sr-only">Cancel</span>
</button>
<button
onClick={saveGridEdit}
@@ -485,7 +485,7 @@ export default function Dashboard() {
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-port-accent text-white hover:bg-port-accent/80 transition-colors text-sm min-h-[40px] disabled:opacity-50"
>
<Save size={14} />
- <span className="hidden sm:inline">{savingGrid ? 'Saving…' : 'Save layout'}</span>
+ <span className="max-sm:sr-only">{savingGrid ? 'Saving…' : 'Save layout'}</span>
</button>
</>
)}
@@ -495,7 +495,7 @@ export default function Dashboard() {
title="Ambient display mode"
>
<Monitor size={14} />
- <span className="hidden sm:inline">Ambient</span>
+ <span className="max-sm:sr-only">Ambient</span>
</Link>
</>
)}
diff --git a/client/src/pages/Security.jsx b/client/src/pages/Security.jsx
index 779b7e25f1..e94930602c 100644
--- a/client/src/pages/Security.jsx
+++ b/client/src/pages/Security.jsx
@@ -312,7 +312,7 @@ export default function Security() {
}`}
>
<Settings size={16} />
- <span className="hidden sm:inline">Settings</span>
+ <span className="max-sm:sr-only">Settings</span>
</button>
</div>
</div>
diff --git a/client/src/pages/SongBookImport.jsx b/client/src/pages/SongBookImport.jsx
index c66f988d44..b2c9a3afa5 100644
--- a/client/src/pages/SongBookImport.jsx
+++ b/client/src/pages/SongBookImport.jsx
@@ -234,7 +234,7 @@ export default function SongBookImport() {
<>
<Link to="/songbook" className={btnClass}>
<ArrowLeft size={15} />
- <span className="hidden sm:inline">SongBook</span>
+ <span className="max-sm:sr-only">SongBook</span>
</Link>
{/* The form's own Save sits below a tall textarea + preview — on a
phone that is ~1000px down. This header copy keeps the primary
diff --git a/client/src/pages/SongBookViewer.jsx b/client/src/pages/SongBookViewer.jsx
index e790b3ec33..897bb99505 100644
--- a/client/src/pages/SongBookViewer.jsx
+++ b/client/src/pages/SongBookViewer.jsx
@@ -580,7 +580,7 @@ export default function SongBookViewer() {
<>
<Link to="/songbook" className={btnClass}>
<ArrowLeft size={15} />
- <span className="hidden sm:inline">All songs</span>
+ <span className="max-sm:sr-only">All songs</span>
</Link>
{editing ? (
<>