fix: announce locked map areas

This commit is contained in:
Nico 2026-06-04 21:35:10 -07:00
parent 67ae2763b2
commit 1ab359d343
2 changed files with 10 additions and 3 deletions

View File

@ -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")}

View File

@ -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 }) => {