Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/forms/form-detail-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ export function FormDetailPage({ form }: { form: FormRecord }) {
</section>

<section id="form-information" aria-label="Form information" className={cn(inPageAnchor, "grid gap-2")}>
<DisclosureGroup items={formInformationItems(detailRows)} headingLevel={3} />
<DisclosureGroup className="min-w-0" items={formInformationItems(detailRows)} headingLevel={3} />
</section>

{/* The `-mobile`/`-desktop` id pairs below are the section anchors
Expand Down
24 changes: 24 additions & 0 deletions tests/ui-forms-section-nav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ const FORM_ROUTE = "/forms/transport-crisis-form";

// Adoption evidence: these browser regressions exercise DisclosureGroup.items[].extendDescription.
test.describe("Forms section navigation", () => {
test("keeps information rows inside the mobile viewport", async ({ page }) => {
for (const width of [320, 390, 639]) {
await page.setViewportSize({ width, height: 844 });
await page.goto(FORM_ROUTE, { waitUntil: "domcontentloaded" });

const section = page.getByRole("region", { name: "Form information" });
await expect(section).toBeVisible({ timeout: 20_000 });

const geometry = await section.locator('[data-testid="disclosure"]').evaluateAll((rows) =>
rows.map((row) => {
const bounds = row.getBoundingClientRect();
return { left: bounds.left, right: bounds.right, width: bounds.width };
}),
);

expect(geometry.length).toBeGreaterThan(0);
for (const row of geometry) {
expect(row.left, `${width}px row must not cross the left viewport edge`).toBeGreaterThanOrEqual(0);
expect(row.right, `${width}px row must not cross the right viewport edge`).toBeLessThanOrEqual(width + 1);
expect(row.width, `${width}px row must retain a usable width`).toBeGreaterThan(0);
}
}
});

test("expands information previews into one continuous answer", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto(FORM_ROUTE, { waitUntil: "domcontentloaded" });
Expand Down
Loading