fix: focus selected map area editor

This commit is contained in:
Nico 2026-06-17 00:34:35 -07:00
parent 5ba538065f
commit c9fbbafe58
2 changed files with 3 additions and 17 deletions

View File

@ -309,16 +309,6 @@ export default function LocationMapBottomSheet({
/>
) : null}
{showSelectedObjectForm && secondaryDraftActions ? (
<div
className="location-map-editor-action-stack location-map-selected-secondary-actions"
role="group"
aria-label="More map draft actions"
>
{secondaryDraftActions}
</div>
) : null}
{showUnmappedPanel ? (
<UnmappedItemsPanel
visibleUnmappedItems={visibleUnmappedItems}

View File

@ -5003,27 +5003,22 @@ test("mobile editor uses bottom sheet controls instead of desktop object toolbar
await expect(lockedFlag).toHaveAttribute("aria-pressed", "false");
await expect(lockedFlag.locator(".location-map-object-flag-state.is-on")).toHaveCount(0);
const selectedPrimaryActions = page.locator(".location-map-selected-primary-actions");
const selectedSecondaryActions = page.locator(".location-map-selected-secondary-actions");
await expect(selectedPrimaryActions.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
await expect(selectedPrimaryActions.getByRole("button", { name: "Publish" })).toBeVisible();
await expect(selectedSecondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible();
await expect(selectedSecondaryActions.getByRole("button", { name: "View Draft" })).toHaveCount(0);
await expect(page.locator(".location-map-selected-secondary-actions")).toHaveCount(0);
await expect(page.getByRole("button", { name: "Bought" })).toHaveCount(0);
const selectedPrimaryBox = await selectedPrimaryActions.boundingBox();
const selectedSecondaryButtonBox = await selectedSecondaryActions.getByRole("button", { name: "Add Area" }).boundingBox();
const labelBox = await labelInput.boundingBox();
const firstFieldRowBox = await fieldRows.first().boundingBox();
const firstFlagButtonBox = await objectFlagButtons.first().boundingBox();
expect(selectedPrimaryBox).not.toBeNull();
expect(selectedSecondaryButtonBox).not.toBeNull();
expect(labelBox).not.toBeNull();
expect(firstFieldRowBox).not.toBeNull();
expect(firstFlagButtonBox).not.toBeNull();
if (!selectedPrimaryBox || !selectedSecondaryButtonBox || !labelBox || !firstFieldRowBox || !firstFlagButtonBox) {
if (!selectedPrimaryBox || !labelBox || !firstFieldRowBox || !firstFlagButtonBox) {
throw new Error("Selected object draft actions were not measurable");
}
expect(selectedPrimaryBox.y).toBeLessThan(labelBox.y);
expect(selectedSecondaryButtonBox.height).toBeGreaterThanOrEqual(40);
expect(firstFieldRowBox.height).toBeLessThanOrEqual(54);
expect(firstFlagButtonBox.height).toBeGreaterThanOrEqual(40);
const closeSelectedButton = page.getByRole("button", { name: "Close selected map area" });
@ -5037,6 +5032,7 @@ test("mobile editor uses bottom sheet controls instead of desktop object toolbar
await expect(page.getByRole("textbox", { name: "Label" })).toHaveCount(0);
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Edit Areas");
await expect(page.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
await expect(page.locator(".location-map-secondary-actions").getByRole("button", { name: "Add Area" })).toBeVisible();
await page.getByRole("button", { name: "View", exact: true }).click();
await expect(page.getByRole("textbox", { name: "Label" })).toHaveCount(0);
});