From 95afcf397860d794019e97922742328422de20af Mon Sep 17 00:00:00 2001 From: Nico Date: Thu, 4 Jun 2026 21:46:59 -0700 Subject: [PATCH] fix: announce map area item counts --- frontend/src/components/maps/LocationMapObject.jsx | 8 +++++--- frontend/tests/location-map-manager.spec.ts | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/maps/LocationMapObject.jsx b/frontend/src/components/maps/LocationMapObject.jsx index b7a3878..0de6d5b 100644 --- a/frontend/src/components/maps/LocationMapObject.jsx +++ b/frontend/src/components/maps/LocationMapObject.jsx @@ -54,14 +54,16 @@ export default function LocationMapObject({ 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 ? `${count} shown` : `${count} item${count === 1 ? "" : "s"}`; + const accessibleLabel = canEditObjects + ? object.locked + ? `Map area ${displayLabel}, locked` + : `Map area ${displayLabel}` + : `Map area ${displayLabel}, ${countLabel}`; const labelLines = fittedLabelLines(object, "Area"); const countY = filters.showLabels && labelLines.length > 1 ? object.y + 76 : object.y + 52; const resizeHandleSize = Math.min(96, Math.max(44, Math.ceil(48 / zoom))); diff --git a/frontend/tests/location-map-manager.spec.ts b/frontend/tests/location-map-manager.spec.ts index 3127217..41ee8c6 100644 --- a/frontend/tests/location-map-manager.spec.ts +++ b/frontend/tests/location-map-manager.spec.ts @@ -3806,6 +3806,8 @@ test("viewer map areas are keyboard selectable", async ({ page }) => { const bakeryArea = page.getByRole("button", { name: "Map area Bakery" }); const frozenArea = page.getByRole("button", { name: "Map area Frozen Foods" }); const bakeryRect = page.locator('[data-object-key="1571"]').locator("rect").first(); + await expect(page.getByRole("button", { name: "Map area Bakery, 2 items", exact: true })).toBeVisible(); + await expect(page.getByRole("button", { name: "Map area Frozen Foods, 0 shown", exact: true })).toBeVisible(); await expect(bakeryArea).toHaveAttribute("aria-pressed", "false"); const initialFill = await bakeryRect.evaluate((element) => getComputedStyle(element).fill);