From 1ab359d3434984d6649bf2d3a1c85a95dcee587b Mon Sep 17 00:00:00 2001 From: Nico Date: Thu, 4 Jun 2026 21:35:10 -0700 Subject: [PATCH] fix: announce locked map areas --- frontend/src/components/maps/LocationMapObject.jsx | 6 +++++- frontend/tests/location-map-manager.spec.ts | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/maps/LocationMapObject.jsx b/frontend/src/components/maps/LocationMapObject.jsx index 02e0605..b7a3878 100644 --- a/frontend/src/components/maps/LocationMapObject.jsx +++ b/frontend/src/components/maps/LocationMapObject.jsx @@ -53,6 +53,10 @@ export default function LocationMapObject({ if (!object.visible || !filters.showZones) return null; const key = getObjectKey(object); + const displayLabel = getMapObjectDisplayLabel(object, index + 1); + const accessibleLabel = canEditObjects && object.locked + ? `Map area ${displayLabel}, locked` + : `Map area ${displayLabel}`; const count = zoneItems.length; const hasHiddenZoneItems = assignedZoneItemCount > count; const countLabel = hasHiddenZoneItems @@ -123,7 +127,7 @@ export default function LocationMapObject({ height={object.height} rx="12" role="button" - aria-label={`Map area ${getMapObjectDisplayLabel(object, index + 1)}`} + aria-label={accessibleLabel} aria-pressed={isSelected} tabIndex={canSelect ? 0 : -1} onPointerDown={(event) => onStartDrag(event, object, "move")} diff --git a/frontend/tests/location-map-manager.spec.ts b/frontend/tests/location-map-manager.spec.ts index 72813b4..3127217 100644 --- a/frontend/tests/location-map-manager.spec.ts +++ b/frontend/tests/location-map-manager.spec.ts @@ -1808,9 +1808,10 @@ test("admin locked map areas hide resize affordances", async ({ page }) => { await expect(page.locator(".location-map-resize-handle")).toBeVisible(); await expect(page.locator(".location-map-lock-badge")).toHaveCount(0); + await expect(page.getByRole("button", { name: "Map area Bakery, locked", exact: true })).toHaveCount(0); await expect(page.getByRole("spinbutton", { name: "X" })).toHaveCount(0); - const lockedToggle = page.getByRole("button", { name: "Locked" }); - const visibleToggle = page.getByRole("button", { name: "Visible" }); + const lockedToggle = page.getByRole("button", { name: "Locked", exact: true }); + const visibleToggle = page.getByRole("button", { name: "Visible", exact: true }); await expect(lockedToggle).toHaveAttribute("aria-pressed", "false"); await lockedToggle.click(); @@ -1824,6 +1825,7 @@ test("admin locked map areas hide resize affordances", async ({ page }) => { await expect(page.locator(".location-map-resize-handle")).toHaveCount(0); await expect(page.locator(".location-map-lock-badge")).toBeVisible(); await expect(bakeryObject).toHaveClass(/is-locked/); + await expect(page.getByRole("button", { name: "Map area Bakery, locked", exact: true })).toBeVisible(); await expect(page.getByText("Unlock this area before moving or resizing it.")).toHaveCount(0); await expect(page.locator(".location-map-status")).toHaveText("Unsaved Draft"); @@ -1835,6 +1837,7 @@ test("admin locked map areas hide resize affordances", async ({ page }) => { await expect(lockedToggle).toHaveAttribute("aria-pressed", "false"); await expect(page.locator(".location-map-resize-handle")).toBeVisible(); await expect(page.locator(".location-map-lock-badge")).toHaveCount(0); + await expect(page.getByRole("button", { name: "Map area Bakery, locked", exact: true })).toHaveCount(0); }); test("admin selected overlapping map area renders above other areas", async ({ page }) => {