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: move AI Presets harness link out of the disclosure button (#9165)

Adam Eivy7a289158e13c
diff --git a/client/src/a11yConventions.test.js b/client/src/a11yConventions.test.js
index 6dbacdb631..6566502fa1 100644
--- a/client/src/a11yConventions.test.js
+++ b/client/src/a11yConventions.test.js
@@ -4347,4 +4347,21 @@ function B() { const sensors = useSensors(useSensor(PointerSensor)); return <Dnd
}
}
expect(offenders, `Conditionally-rendered error text that announces nothing — render <Banner tone="error"> (it supplies role="alert" itself), or add role="alert" for an error the user's own action produced and role="status" for a passive load failure (WCAG 4.1.3):\n${offenders.join('\n')}`).toEqual([]); });
+
+ it('keeps interactive elements out of a CollapsibleSection label (#9165)', () => {
+ // The label renders inside the header <button>; a link or button there is
+ // nested-interactive (WCAG 4.1.2). It belongs in `headerActions`.
+ const offenders = [];
+ const interactiveIn = (label) => /<(Link|NavLink|a|button)[\s/>]/.test(label ?? '');
+ expect(interactiveIn('<span><Link to="/x">go</Link></span>')).toBe(true);
+ expect(interactiveIn('<span><a href="/x">go</a></span>')).toBe(true);
+ expect(interactiveIn('<span>plain <b>text</b></span>')).toBe(false);
+ for (const file of trackedJsxFiles()) {
+ const src = maskedSourceOf(file);
+ for (const node of forEachOpeningTag(src, 'CollapsibleSection')) {
+ if (interactiveIn(attributeValue(node.tag, 'label'))) offenders.push(`${file}:${lineOf(src, node.index)}`);
+ }
+ }
+ expect(offenders, `Interactive element inside a CollapsibleSection label — pass it as headerActions so it sits beside the toggle button, not inside it:\n${offenders.join('\n')}`).toEqual([]);
+ });
});
diff --git a/client/src/components/ui/CollapsibleSection.jsx b/client/src/components/ui/CollapsibleSection.jsx
index 0313ed377c..4ba9ad8d2e 100644
--- a/client/src/components/ui/CollapsibleSection.jsx
+++ b/client/src/components/ui/CollapsibleSection.jsx
@@ -12,7 +12,9 @@ import { ChevronDown, ChevronRight } from 'lucide-react';
//
// Deliberately NOT here: a per-site `text-left` (the base-layer rule in
// index.css already left-aligns wrapped flex-button labels), animation, or
-// nesting support. Open state defaults to internal — the controlled
+// nesting support inside the header button (a link/button in `label` is invalid
+// nested-interactive markup — pass it as `headerActions`, which renders as a
+// sibling of the button). Open state defaults to internal — the controlled
// `open`/`onOpenChange` pair below is opt-in for the one call site that has to
// drive it from outside the header.
//
@@ -79,6 +81,10 @@ export default function CollapsibleSection({
// "More" disclosure. The attribute sits on a wrapper the caller can't
// restyle, so a `bodyClassName` display utility can't defeat it.
keepMounted = false,
+ // Interactive chrome (a link, an icon button) shown at the end of the header
+ // row. Rendered OUTSIDE the toggle `<button>` — an interactive element nested
+ // in a button is invalid HTML and drops out of the accessibility tree.
+ headerActions = null,
children,
}) {
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
@@ -91,14 +97,13 @@ export default function CollapsibleSection({
};
const tone = SIZES[size] || SIZES.sm;
const Chevron = open ? ChevronDown : ChevronRight;
- return (
- <div className={className}>
+ const header = (
<button
type="button"
aria-expanded={open}
onClick={toggle}
aria-controls={id && (open || keepMounted) ? id : undefined}
- className={`flex w-full items-center ${tone.button} ${buttonClassName}`.trim()}
+ className={`flex ${headerActions ? 'min-w-0 flex-1' : 'w-full'} items-center ${tone.button} ${buttonClassName}`.trim()}
>
<Chevron size={tone.iconSize} className="shrink-0" />
{Icon ? <Icon size={tone.iconSize} className="shrink-0" /> : null}
@@ -111,6 +116,17 @@ export default function CollapsibleSection({
? <span className={`min-w-0 truncate ${tone.summary}`.trim()}>{summary}</span>
: null}
</button>
+ );
+ return (
+ <div className={className}>
+ {headerActions
+ ? (
+ <div className="flex w-full items-center gap-2">
+ {header}
+ <div className="shrink-0">{headerActions}</div>
+ </div>
+ )
+ : header}
{keepMounted
? <div id={id} hidden={!open}><div className={bodyClassName}>{children}</div></div>
: open ? <div id={id} className={bodyClassName}>{children}</div> : null}
diff --git a/client/src/components/ui/CollapsibleSection.test.jsx b/client/src/components/ui/CollapsibleSection.test.jsx
index 785e1dad19..c5bd432699 100644
--- a/client/src/components/ui/CollapsibleSection.test.jsx
+++ b/client/src/components/ui/CollapsibleSection.test.jsx
@@ -89,4 +89,18 @@ describe('CollapsibleSection', () => {
rerender(<CollapsibleSection label="Outfits" size="md">body</CollapsibleSection>);
expect(container.querySelector('button')).toHaveClass('text-gray-400');
});
+
+ it('renders headerActions as a sibling of the toggle button, never inside it', () => {
+ const { container } = render(
+ <CollapsibleSection label="Claude" headerActions={<a href="/harness">harness →</a>}>
+ body
+ </CollapsibleSection>,
+ );
+ const button = screen.getByRole('button', { name: 'Claude' });
+ expect(button.querySelector('a, button')).toBeNull();
+ expect(container.querySelectorAll('button a, a button')).toHaveLength(0);
+ const link = screen.getByRole('link', { name: 'harness →' });
+ fireEvent.click(link);
+ expect(button).toHaveAttribute('aria-expanded', 'false');
+ });
});
diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsx
index 6c504e9f2f..a825ebb3a5 100644
--- a/client/src/pages/AIProviders.jsx
+++ b/client/src/pages/AIProviders.jsx
@@ -1168,13 +1168,13 @@ export default function AIProviders() {
<span className="text-xs text-gray-500">
{section.hint || `${formatCount(section.ready)} of ${formatCount(sectionProviders.length)} can run`}
</span>
- {section.link && (
- <Link to={section.link} onClick={(e) => e.stopPropagation()} className="text-xs text-port-accent hover:underline">
- harness →
- </Link>
- )}
</span>
)}
+ headerActions={section.link ? (
+ <Link to={section.link} className="text-xs text-port-accent hover:underline">
+ harness →
+ </Link>
+ ) : null}
>
{sectionProviders.map(provider => (
<ProviderCard