Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(PageSectionHeader): correct heading hierarchy for accessibility

Steven Enamakel72093638eafd
diff --git a/app/src/components/layout/PageSectionHeader.tsx b/app/src/components/layout/PageSectionHeader.tsx
index e047405d04..faf8473b67 100644
--- a/app/src/components/layout/PageSectionHeader.tsx
+++ b/app/src/components/layout/PageSectionHeader.tsx
@@ -1,5 +1,8 @@
import type { ReactNode } from 'react';
+import { cn } from '../../lib/cn';
+import { contentWidthVariants, type ContentWidth } from './contentWidth';
+
/**
* PageSectionHeader — the canonical header for a functional page view: a title
* (16px semibold) over an optional one-line description (14px muted), with an
@@ -8,7 +11,9 @@ import type { ReactNode } from 'react';
*
* Render it as the first element inside a page's content column so it inherits
* the same max-width and centering as the content beneath it — header and body
- * stay aligned. Pass width/centering via `className` (e.g. `mx-auto max-w-2xl`).
+ * stay aligned. Use `width` for the named scale (`sm` / `md` / `lg` / `full`,
+ * see `contentWidth.ts`); `className` remains for one-off overrides and still
+ * merges (via `cn`, last-wins) on top of it.
*/
interface PageSectionHeaderProps {
title: ReactNode;
@@ -18,7 +23,14 @@ interface PageSectionHeaderProps {
action?: ReactNode;
/** Optional chip/tab row rendered inside the card, below the title row. */
tabs?: ReactNode;
- /** Width / positioning classes (the card chrome is applied internally). */
+ /**
+ * Cap the header's width and center it (`mx-auto`). Defaults to `'full'` —
+ * today's behavior, where the caller supplies width/centering via
+ * `className` (still supported; see `Notifications.tsx`'s
+ * `mx-auto max-w-3xl`, equivalent to `width="lg"`).
+ */
+ width?: ContentWidth;
+ /** Extra classes on the card (merged via `cn`, last-wins over `width`). */
className?: string;
testId?: string;
}
@@ -28,13 +40,18 @@ export default function PageSectionHeader({
description,
action,
tabs,
+ width = 'full',
className = '',
testId,
}: PageSectionHeaderProps) {
return (
<header
data-testid={testId}
- className={`rounded-2xl border border-line bg-surface px-4 py-3 shadow-subtle ${className}`}>
+ className={cn(
+ 'rounded-2xl border border-line bg-surface px-4 py-3 shadow-subtle',
+ width !== 'full' && ['mx-auto w-full', contentWidthVariants({ width })],
+ className
+ )}>
<div className="flex items-start justify-between gap-3">
<div className="min-w-0">
<h1 className="text-base font-semibold text-content">{title}</h1>