feat(web): editor navigation returns to its origin, hidden pages orient in the tree, page actions on the page #154

Merged
dominik.polakovics merged 1 commit from afk/149 into main 2026-10-06 11:24:12 +02:00

Closes #149

What changes

  • return chain: a validated return query parameter records the view each more detailed view was opened from. The helpers are parseReturn, readReturn and withReturn in web/src/routing.ts, and useReturn in web/src/returnnav.ts, which the shell provides through ReturnContext.

    • Writers: List row titles, List create (for the properties view it opens), View-module preview clicks, the element pencil, title and insert follow (the links' href carries it too), and the Properties button.
    • Readers: properties Close and Save & close, the edit page's Close, Save & Close and "Back to page", the page module's back button, and the delete follow.
    • The chain nests and survives a reload.
    • Other origins, //host, //page/en/x, backslashes and unknown modules are ignored.
    • Tree clicks, breadcrumb clicks and rail switches build parameter-less routes. A repaired route carries no query (new test).
  • Back button in the page docheader, first in the row and labelled with its target. A hidden page with no return falls back to its parent section's List. There is none for a visible page without a return, and none in properties.

  • Tree orientation: a page inside a hideChildPages section selects the section's row (styling and aria-current). Every navigation expands the selected row's ancestors and scrolls the row into view when it is off-screen.

  • Breadcrumbs show titles with home first (Home / News / Summer meetup). One shared pathCrumbs builder serves the page and List modules. The Media module is unchanged.

  • Page actions: one shared definition (web/src/pageactions.ts) feeds three places:

    • the tree row menu, which keeps New subpage and Move up/down;
    • the List rows, which gain Rename…;
    • a new "⋯" docheader menu, which is not shown on the content root.

    Rename in the List and the docheader asks for the title in a RenameDialog. Each surface decides where it goes afterwards:

    • a List row's action leaves the List on its section;
    • a docheader rename follows the page to its new path, replacing the history entry and keeping return;
    • a docheader delete replaces the history entry and lands on return, else on the parent's List for a hidden page, else on the parent page.
  • Delete dialog names the page by its type label ("Delete News item “Q2 results”?") and warns about descendants only when there are any.

No scaffold/site/AGENTS.md change: this touches editor navigation only, as the issue states.

Verification

  • make test: vitest 60 files, 1693 tests, all passing; go test ./... passes; go vet ./... is clean.
  • Browser walkthrough against harness serve on a site with harness add news and a git remote, driven by Playwright with the system Chromium. Every acceptance flow in the issue passed, with no console errors apart from the expected local 404 /api/host.
  • One deliberate difference: deleting the open page when its return points into the deleted subtree skips that return and lands on the parent, so the editor never lands on a page that is gone.

🤖 Generated with Claude Code

Closes #149 ## What changes - **`return` chain**: a validated `return` query parameter records the view each more detailed view was opened from. The helpers are `parseReturn`, `readReturn` and `withReturn` in `web/src/routing.ts`, and `useReturn` in `web/src/returnnav.ts`, which the shell provides through `ReturnContext`. - Writers: List row titles, List create (for the properties view it opens), View-module preview clicks, the element pencil, title and insert follow (the links' `href` carries it too), and the Properties button. - Readers: properties Close and Save & close, the edit page's Close, Save & Close and "Back to page", the page module's back button, and the delete follow. - The chain nests and survives a reload. - Other origins, `//host`, `//page/en/x`, backslashes and unknown modules are ignored. - Tree clicks, breadcrumb clicks and rail switches build parameter-less routes. A repaired route carries no query (new test). - **Back button** in the page docheader, first in the row and labelled with its target. A hidden page with no `return` falls back to its parent section's List. There is none for a visible page without a `return`, and none in properties. - **Tree orientation**: a page inside a `hideChildPages` section selects the section's row (styling and `aria-current`). Every navigation expands the selected row's ancestors and scrolls the row into view when it is off-screen. - **Breadcrumbs** show titles with home first (`Home / News / Summer meetup`). One shared `pathCrumbs` builder serves the page and List modules. The Media module is unchanged. - **Page actions**: one shared definition (`web/src/pageactions.ts`) feeds three places: - the tree row menu, which keeps New subpage and Move up/down; - the List rows, which gain Rename…; - a new "⋯" docheader menu, which is not shown on the content root. Rename in the List and the docheader asks for the title in a `RenameDialog`. Each surface decides where it goes afterwards: - a List row's action leaves the List on its section; - a docheader rename follows the page to its new path, replacing the history entry and keeping `return`; - a docheader delete replaces the history entry and lands on `return`, else on the parent's List for a hidden page, else on the parent page. - **Delete dialog** names the page by its type label ("Delete News item “Q2 results”?") and warns about descendants only when there are any. No `scaffold/site/AGENTS.md` change: this touches editor navigation only, as the issue states. ## Verification - `make test`: vitest 60 files, 1693 tests, all passing; `go test ./...` passes; `go vet ./...` is clean. - Browser walkthrough against `harness serve` on a site with `harness add news` and a git remote, driven by Playwright with the system Chromium. Every acceptance flow in the issue passed, with no console errors apart from the expected local `404 /api/host`. - One deliberate difference: deleting the open page when its `return` points into the deleted subtree skips that `return` and lands on the parent, so the editor never lands on a page that is gone. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(web): editor navigation returns to its origin, hidden pages orient in the tree, page actions on the page
All checks were successful
ci / build-and-test (pull_request) Successful in 8m12s
575879cba1
- A validated `return` query parameter (routing.ts parseReturn/readReturn/
  withReturn, returnnav.ts useReturn) records the view each detailed view was
  opened from. List row titles, List create, preview clicks, element
  pencil/title/insert and the Properties button write it; properties
  Close/Save & close, the element edit page's closes and the page module's
  new back button read it. The chain nests, survives reload, and refuses
  other origins, protocol-relative values and unknown modules.
- The page module shows a back button labelled with its target; a page
  hidden inside a hideChildPages section falls back to its parent's List.
- The tree selects a hidden page's section row, expands to the selected row
  on every navigation and scrolls it into view.
- Breadcrumbs in the page and List modules show titles, home first, from
  one shared pathCrumbs builder.
- One shared page-action definition (pageactions.ts) feeds the tree row
  menu, the List rows (now with Rename…) and a new docheader "⋯" menu;
  docheader rename/delete follow with replace and honor `return`.
- The delete dialog names the page by its type label and warns about
  descendants only when there are any.

Closes #149

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

[autoland] verdict: pass

This was generated by AI while landing a PR.

Verdict: PASS

  • Signal relied on: Forgejo Actions ci / build-and-test green (run 137, 8m12s). Not re-run.
  • Conventions: Conventional Commits title; body carries Closes #149; single commit on top of current main (no conflict).
  • Scope: diff matches #149's contract: return helpers beside parseRoute/buildRoute, the listed writers and readers, back button, hidden-page tree orientation and reveal, title breadcrumbs through one pathCrumbs, shared page actions (pageactions.ts) across tree, List and docheader, and the delete-dialog copy. No drive-by changes.
  • Open-redirect guard: parseReturn rejects other origins, schemes, //host, //page/en/x (checked before parsing), backslashes and unknown modules, all covered in routing.test.ts. The repaired-route-has-no-query test is in routerepair.test.ts.
  • AGENTS.md: no change needed. The change is editor-only, and the hideChildPages and create paragraphs stay true.
[autoland] verdict: pass > *This was generated by AI while landing a PR.* **Verdict: PASS** - **Signal relied on:** Forgejo Actions `ci / build-and-test` green (run 137, 8m12s). Not re-run. - **Conventions:** Conventional Commits title; body carries `Closes #149`; single commit on top of current `main` (no conflict). - **Scope:** diff matches #149's contract: `return` helpers beside `parseRoute`/`buildRoute`, the listed writers and readers, back button, hidden-page tree orientation and reveal, title breadcrumbs through one `pathCrumbs`, shared page actions (`pageactions.ts`) across tree, List and docheader, and the delete-dialog copy. No drive-by changes. - **Open-redirect guard:** `parseReturn` rejects other origins, schemes, `//host`, `//page/en/x` (checked before parsing), backslashes and unknown modules, all covered in `routing.test.ts`. The repaired-route-has-no-query test is in `routerepair.test.ts`. - **AGENTS.md:** no change needed. The change is editor-only, and the `hideChildPages` and `create` paragraphs stay true.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/deckle!154
No description provided.