From 0f74f3a461660b5a4d28d191272e14d89372a0f2 Mon Sep 17 00:00:00 2001 From: MFrancis-dev Date: Sat, 21 Nov 2026 17:12:27 +0100 Subject: [PATCH 1/7] fix(frontend): associate the dashboard settings template input with a label (#632) The settings-tab "Create Stream" panel named its only control with `aria-label`, so there was no label element to anchor and no id for tests to target. Give the input an id plus an sr-only sibling label so the accessible name comes from a real association, with no layout change. The issue cites `dashboard-view.tsx:879` and recipient/token/amount at 922-934. That wizard moved and already pairs htmlFor with ids; the template-name input is the gap that remains in this form. --- .../dashboard/DashboardSettings.test.tsx | 61 +++++++++++++++++++ .../dashboard/DashboardSettings.tsx | 5 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 frontend/src/components/dashboard/DashboardSettings.test.tsx diff --git a/frontend/src/components/dashboard/DashboardSettings.test.tsx b/frontend/src/components/dashboard/DashboardSettings.test.tsx new file mode 100644 index 00000000..91246949 --- /dev/null +++ b/frontend/src/components/dashboard/DashboardSettings.test.tsx @@ -0,0 +1,61 @@ +import { render, screen } from "@testing-library/react"; +import { describe, expect, it, vi } from "vitest"; +import { DashboardSettings } from "./DashboardSettings"; +import type { WalletSession } from "@/lib/wallet"; + +const session: WalletSession = { + walletId: "freighter", + walletName: "Freighter", + publicKey: "GABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC", + connectedAt: "2026-11-21T00:00:00.000Z", + network: "testnet", + mocked: false, +}; + +function renderSettings() { + return render(); +} + +describe("DashboardSettings form labeling (#632)", () => { + it("associates the template name input with a label via id + htmlFor", () => { + const { container } = renderSettings(); + + const input = screen.getByLabelText("Template name"); + expect(input).toBeInTheDocument(); + expect(input.tagName).toBe("INPUT"); + expect(input).toHaveAttribute("id", "stream-template-name"); + + const label = container.querySelector( + 'label[for="stream-template-name"]', + ); + expect(label).not.toBeNull(); + expect(label?.textContent?.trim()).toBe("Template name"); + }); + + it("keeps the label visually hidden so the layout is unchanged", () => { + const { container } = renderSettings(); + + const label = container.querySelector('label[for="stream-template-name"]'); + expect(label?.getAttribute("class")).toContain("sr-only"); + }); + + it("gives every form control an id and a programmatic label", () => { + const { container } = renderSettings(); + + const controls = container.querySelectorAll( + "input, textarea, select", + ); + expect(controls.length).toBeGreaterThan(0); + + for (const control of controls) { + expect(control.id, `${control.tagName} is missing an id`).not.toBe(""); + expect( + container.querySelector(`label[for="${CSS.escape(control.id)}"]`), + `${control.id} has no label targeting it`, + ).not.toBeNull(); + } + + // Each control must resolve through its accessible name, not just markup. + expect(screen.getAllByLabelText("Template name")).toHaveLength(1); + }); +}); diff --git a/frontend/src/components/dashboard/DashboardSettings.tsx b/frontend/src/components/dashboard/DashboardSettings.tsx index fcf8adf3..bd74f37a 100644 --- a/frontend/src/components/dashboard/DashboardSettings.tsx +++ b/frontend/src/components/dashboard/DashboardSettings.tsx @@ -22,9 +22,12 @@ export function DashboardSettings({ session, onDisconnect }: DashboardSettingsPr

+