Skip to content

Commit dd4cf6c

Browse files
fix(dashboard): add type='button' to 96 buttons across 36 files
Adds type="button" to all buttons missing explicit type attribute to prevent latent form-submit bugs. Recovery from botched remerge of #3292.
1 parent 70ba027 commit dd4cf6c

36 files changed

Lines changed: 96 additions & 96 deletions

dashboard/src/__tests__/a11y-pages.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Layout from '../components/Layout';
2525
vi.mock('../components/overview/HomeStatusPanel', () => ({
2626
default: ({ onCreateFirstSession }: { onCreateFirstSession: () => void }) => (
2727
<div data-testid="home-status-panel">
28-
<button onClick={onCreateFirstSession}>Create first session</button>
28+
<button type="button" onClick={onCreateFirstSession}>Create first session</button>
2929
</div>
3030
),
3131
}));

dashboard/src/__tests__/i18n-context.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function TestComponent() {
1616
<div data-testid="title">{t('overview.title')}</div>
1717
<div data-testid="subtitle">{t('overview.subtitle')}</div>
1818
<div data-testid="missing">{t('nonexistent.key')}</div>
19-
<button onClick={() => setLocale('de-DE')}>Change to German</button>
19+
<button type="button" onClick={() => setLocale('de-DE')}>Change to German</button>
2020
</div>
2121
);
2222
}

dashboard/src/__tests__/i18n-integration.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ describe('i18n integration', () => {
6767
<div>
6868
<span data-testid="current-locale">{locale}</span>
6969
<span>{t('settings.display.title')}</span>
70-
<button onClick={() => setLocale('it-IT')}>Switch to Italian</button>
71-
<button onClick={() => setLocale('en-US')}>Switch to English</button>
70+
<button type="button" onClick={() => setLocale('it-IT')}>Switch to Italian</button>
71+
<button type="button" onClick={() => setLocale('en-US')}>Switch to English</button>
7272
</div>
7373
);
7474
}
@@ -94,7 +94,7 @@ describe('i18n integration', () => {
9494
it('persists locale choice to localStorage', () => {
9595
function LocaleWriter() {
9696
const { setLocale } = useLocale();
97-
return <button onClick={() => setLocale('it-IT')}>Set Italian</button>;
97+
return <button type="button" onClick={() => setLocale('it-IT')}>Set Italian</button>;
9898
}
9999

100100
render(

dashboard/src/components/ActivityStream.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export default function ActivityStream({
210210

211211
{/* Clear filters */}
212212
{(filterSession || filterType) && (
213-
<button
213+
<button type="button"
214214
onClick={() => { setFilterSession(null); setFilterType(null); }}
215215
className="min-h-[44px] min-w-[44px] flex items-center justify-center text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]"
216216
>

dashboard/src/components/CreatePipelineModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default function CreatePipelineModal({ open, onClose }: CreatePipelineMod
124124
{/* Header */}
125125
<div className="flex items-center justify-between px-4 sm:px-5 py-4 border-b border-[var(--color-void-lighter)]">
126126
<h2 className="text-sm font-semibold text-[var(--color-text-primary)]">New Pipeline</h2>
127-
<button aria-label={t("aria.close")}
127+
<button type="button" aria-label={t("aria.close")}
128128
onClick={handleClose}
129129
className="min-h-[44px] min-w-[44px] flex items-center justify-center text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors"
130130
>

dashboard/src/components/CreateSessionModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export default function CreateSessionModal({ open, onClose }: CreateSessionModal
237237
)}
238238
</div>
239239
</div>
240-
<button aria-label={t("aria.close")}
240+
<button type="button" aria-label={t("aria.close")}
241241
onClick={handleClose}
242242
className="min-h-[44px] min-w-[44px] flex items-center justify-center text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors"
243243
>

dashboard/src/components/KeyboardShortcutsHelp/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function KeyboardShortcutsHelp({
4242
<Keyboard className="h-5 w-5 text-[var(--color-accent-cyan)]" />
4343
<h2 className="text-lg font-semibold text-[var(--color-text-primary)]">Keyboard Shortcuts</h2>
4444
</div>
45-
<button
45+
<button type="button"
4646
onClick={onClose}
4747
className="rounded p-1 text-[var(--color-text-muted)] hover:bg-[var(--color-void-lighter)]/50 hover:text-[var(--color-text-primary)] transition-colors"
4848
aria-label={t("aria.close")}

dashboard/src/components/SaveTemplateModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default function SaveTemplateModal({ open, onClose, sessionId }: SaveTemp
103103
{/* Header */}
104104
<div className="flex items-center justify-between px-4 sm:px-5 py-4 border-b border-[var(--color-void-lighter)]">
105105
<h2 className="text-sm font-semibold text-[var(--color-text-primary)]">Save as Template</h2>
106-
<button aria-label={t("aria.close")}
106+
<button type="button" aria-label={t("aria.close")}
107107
onClick={handleClose}
108108
className="min-h-[44px] min-w-[44px] flex items-center justify-center text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors"
109109
>

dashboard/src/components/TemplateModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export default function TemplateModal({ open, onClose, template, onSaved }: Temp
166166
<h2 className="text-sm font-semibold text-[var(--color-text-primary)]">
167167
{isEditing ? 'Edit Template' : 'Create Template'}
168168
</h2>
169-
<button aria-label={t("aria.close")}
169+
<button type="button" aria-label={t("aria.close")}
170170
onClick={handleClose}
171171
className="min-h-[44px] min-w-[44px] flex items-center justify-center text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors"
172172
>

dashboard/src/components/ToastContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function ToastItem({
130130
)}
131131
</div>
132132
{undoAction && (
133-
<button
133+
<button type="button"
134134
onClick={handleUndo}
135135
className="shrink-0 flex items-center gap-1 rounded px-2 py-1 text-xs font-medium opacity-80 hover:opacity-100 transition-opacity bg-current/10"
136136
aria-label={t("aria.undo")}
@@ -139,7 +139,7 @@ function ToastItem({
139139
Undo
140140
</button>
141141
)}
142-
<button
142+
<button type="button"
143143
onClick={() => removeToast(id)}
144144
className="shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 transition-opacity"
145145
aria-label={t("aria.dismiss")}
@@ -165,7 +165,7 @@ export default function ToastContainer() {
165165
>
166166
{toasts.length > 1 && (
167167
<div className="flex justify-end pointer-events-auto">
168-
<button
168+
<button type="button"
169169
onClick={() => toasts.forEach((t) => removeToast(t.id))}
170170
className="flex items-center gap-1 rounded px-2 py-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors"
171171
aria-label={t("aria.dismissAll")}

0 commit comments

Comments
 (0)