> **SUPERSEDED — HISTORICAL RECORD ONLY (archived 2026-07-18).** This document is part of the original "superpowers" wayleave build, whose design diverged from the projects-module patterns it should have mirrored. Do NOT use it as a pattern source for wayleave or any new module. The wayleave module is being realigned to the projects module (meta-driven fields, OpenLayers, shared JS) — see CLAUDE.md.

# Wayleave V4 Updates — Change Manifest

Companion to `2026-04-27-wayleave_module-v4-updates.md`.
Completed 2026-04-27. Every change below was verified in-browser by the user at its task checkpoint.

---

## Created

None.

---

## Modified (3)

| File | Change |
|---|---|
| `www/js/wayleave_edit_v2.js` | Removed always-on `selectInteraction` + `modifyInteraction` from `initMap()` and the associated `select` / `modifyend` handlers (which auto-saved on every vertex drag). Tagged `polyLayer` with `title: 'Wayleave Boundary', isEditable: true`; entity point layers tagged with their titles. Rewrote `singleclick` handler to collect ALL features at the clicked pixel via `forEachFeatureAtPixel` (hitTolerance 6) and build a unified popup list matching projectedit's `Feature N / Layer: ... [Edit] / attributes` pattern. Added `popupEnabled` flag (flipped off while drawing or in edit mode). Added `editStyle` (blue stroke + yellow vertex dots, mirrors projectedit `editstyles`). Added `startEditingPolygon(feature)` — stores `originalGeometry`, applies `editStyle`, creates a per-feature `ol.interaction.Modify`, opens attributes sidebar, enables Confirm button. Added `confirmEditing()` — stages the edit (`edited: true`), removes Modify, restores layer style, closes sidebar, re-enables popup, updates panel Save button count. Added `cancelEditing()` — restores `originalGeometry`, removes Modify, closes sidebar. Added `saveMapEdits()` — iterates all `edited: true` features in `viewPolySource` and calls `savePolygon('update', ...)` for each in one pass. Added `updateSavePanel()` — keeps the panel Save button label and disabled state in sync with the staged-edit count. Fixed `startDraw()` — removed dead `selectInteraction` reference; now flips `popupEnabled` off on draw start, on again on draw end. Updated `wireMapButtons()` to bind Confirm, Cancel, Save Map Edits (panel), Delete confirm-swap, and Attributes sidebar toggle. |
| `www/html/html_body_wayleaveedit.php` | Map tab: added `#wl-sidebar-attributes` (glass sidebar matching `.wl-map-sidebar`) containing Confirm, Cancel, Delete Polygon + Yes/No confirm buttons. Updated `#wl-map-buttons` panel: removed Delete (now in sidebar), added Attributes toggle button and Save Map Edits panel button (disabled until ≥1 edit staged). |
| `www/css/wayleave_edit_v2.css` | Added `#wl-sidebar-attributes` glass styles (same `rgba(255,255,255,0.4)` + `backdrop-filter` treatment as `.wl-map-sidebar`; `max-width: 260px`; `overflow-y: auto`). Updated `.wl-view-popup` to match `project_edit_v2.css` `.feature-popup` exactly: `padding: 15px`, `border-radius: 10px`, `min-width: 300px`, `max-width/height: 400px`, `overflow-y: auto`, `z-index: 10000`. Removed `font-size: 0.85rem` override so popup inherits page body size. Updated `.wl-view-popup-closer` to match: `font-size: 24px`, `right: 16px`. Added `.wl-view-popup-content { margin-top: 10px }`. |

---

## Behaviour change summary

| Old | New |
|---|---|
| Clicking a polygon boundary immediately entered edit mode via always-on `Select` interaction | Clicking anywhere shows a unified popup listing all features at that pixel |
| Clicking a UPRN point while a polygon was nearby could accidentally select the polygon | UPRN clicks and boundary clicks are handled in the same handler; each feature gets its own list entry |
| Every vertex drag triggered an immediate `savePolygon('update', ...)` DB write | Geometry changes are local until the user clicks Confirm (stage) then Save Map Edits (commit) |
| No way to cancel a geometry edit in progress | Cancel button restores the `originalGeometry` snapshot taken at edit-entry |
| Delete was always reachable from the map button panel | Delete is only accessible inside the attributes sidebar, which only opens when a polygon is in edit mode |
| Popup was smaller (0.85rem font, 220px min-width) than projectedit | Popup now matches `.feature-popup` dimensions and inherits body font size |

---

## Feedback coverage — `2026-04-27-wayleave_module-v3-feedback.md`

| Item | Status | Task |
|---|---|---|
| Clicking boundary enters edit instantly, conflicts with UPRN popup | ✅ | T1 |
| Auto-save on every drag generates excessive DB writes + audit log entries | ✅ | T2 |
| Map editing style/flow does not match `project_edit_v2.js` | ✅ | T1 + T2 |

---

## Verification trail

- T1: Unified popup working — user confirmed layout correct after CSS font/size fix.
- T2: Confirm → Save Map Edits flow confirmed working by user.
