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: expose theme selection state to assistive tech (#5132)

[._.]/ Adam Eivyb37c6ffd96a1
diff --git a/client/src/components/ThemeSwitcher.jsx b/client/src/components/ThemeSwitcher.jsx
index 73e580008f..e7945df2b1 100644
--- a/client/src/components/ThemeSwitcher.jsx
+++ b/client/src/components/ThemeSwitcher.jsx
@@ -42,6 +42,8 @@ export default function ThemeSwitcher({ position = 'above', className = '' }) {
{open && createPortal(
<div
ref={menuRef}
+ role="menu"
+ aria-label="Interface theme"
className="fixed max-w-[calc(100vw-1rem)] bg-port-card border border-port-border rounded-xl shadow-xl z-[100] p-2"
style={{
left: menuStyle?.left ?? `${VIEWPORT_PADDING}px`,
@@ -60,6 +62,8 @@ export default function ThemeSwitcher({ position = 'above', className = '' }) {
return (
<button
key={option.id}
+ role="menuitemradio"
+ aria-checked={active}
onClick={() => { setTheme(option.id); setOpen(false); }}
className={`w-full flex items-center gap-3 px-2.5 py-2.5 rounded-lg text-sm transition-colors ${
active
diff --git a/client/src/components/ThemeSwitcher.test.jsx b/client/src/components/ThemeSwitcher.test.jsx
new file mode 100644
index 0000000000..1f09c4a8be
--- /dev/null
+++ b/client/src/components/ThemeSwitcher.test.jsx
@@ -0,0 +1,42 @@
+import { fireEvent, render, screen, within } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+import ThemeSwitcher from './ThemeSwitcher';
+
+vi.mock('./ThemeContext', () => ({
+ useThemeContext: () => ({
+ themeId: 'classic-midnight',
+ theme: { label: 'Classic Midnight' },
+ themeList: [
+ {
+ id: 'classic-midnight',
+ label: 'Classic Midnight',
+ shortLabel: 'Classic',
+ density: 'comfortable',
+ family: 'classic',
+ accent: '#2563eb',
+ },
+ {
+ id: 'blueprint-day',
+ label: 'Blueprint Day',
+ shortLabel: 'Blueprint',
+ density: 'compact',
+ family: 'blueprint',
+ accent: '#0ea5e9',
+ },
+ ],
+ setTheme: vi.fn(),
+ }),
+}));
+
+describe('ThemeSwitcher', () => {
+ it('exposes the current theme through accessible menu radio state', () => {
+ render(<ThemeSwitcher />);
+ fireEvent.click(screen.getByRole('button', { name: /Switch theme/ }));
+
+ const menu = screen.getByRole('menu', { name: 'Interface theme' });
+ expect(within(menu).getByRole('menuitemradio', { name: /Classic Midnight/ }))
+ .toHaveAttribute('aria-checked', 'true');
+ expect(within(menu).getByRole('menuitemradio', { name: /Blueprint Day/ }))
+ .toHaveAttribute('aria-checked', 'false');
+ });
+});