fix: stabilize map history controls

This commit is contained in:
Nico 2026-06-04 17:47:29 -07:00
parent 11979af190
commit 5f1eb30080
3 changed files with 10 additions and 4 deletions

View File

@ -104,6 +104,7 @@ export default function LocationMapToolbar({
<div
className={`location-map-history-buttons ${canUseHistoryControls ? "" : "is-inactive"}`}
aria-label="Edit history"
aria-hidden={!canUseHistoryControls}
>
<button
type="button"

View File

@ -184,6 +184,11 @@
gap: 0.3rem;
}
.location-map-history-buttons.is-inactive {
visibility: hidden;
pointer-events: none;
}
.location-map-history-buttons button {
min-width: 40px;
padding-inline: 0.55rem;

View File

@ -1391,15 +1391,15 @@ test("mobile keeps draft preview status compact in the topbar", async ({ page })
expect(modeBox.width).toBeLessThanOrEqual(126);
expect(reservedHistoryBox.width).toBeGreaterThanOrEqual(82);
expect(reservedHistoryBox.x).toBeGreaterThan(modeBox.x + modeBox.width - 1);
await expect(historyActions.getByRole("button", { name: "Undo" })).toBeVisible();
await expect(historyActions.getByRole("button", { name: "Redo" })).toBeVisible();
await expect(historyActions.getByRole("button", { name: "Undo" })).toBeDisabled();
await expect(historyActions.getByRole("button", { name: "Redo" })).toBeDisabled();
await expect(historyActions).toHaveCSS("visibility", "hidden");
await expect(historyActions.locator('button[aria-label="Undo"]')).toBeDisabled();
await expect(historyActions.locator('button[aria-label="Redo"]')).toBeDisabled();
expect(zoomBox.y).toBeLessThan(modeBox.y + modeBox.height);
expect(zoomBox.x).toBeGreaterThan(reservedHistoryBox.x + reservedHistoryBox.width - 1);
expect(zoomBox.x + zoomBox.width).toBeLessThanOrEqual(toolbarBox.x + toolbarBox.width + 1);
await page.getByRole("button", { name: "Edit Draft" }).click();
await expect(historyActions).toHaveCSS("visibility", "visible");
await expect(historyActions.getByRole("button", { name: "Undo" })).toBeVisible();
await expect(historyActions.getByRole("button", { name: "Redo" })).toBeVisible();
const editToolbarBox = await toolbar.boundingBox();