Skip to content

Admin nav: keep a folded item lit when a role may open only a later, nested tab #517

Open

Description

@mchestr

Follow-up from #514 (admin navigation restructure). Latent today: no role has this shape, and a nav test (every role lights every tab it may open, lib/admin/__tests__/nav.test.ts) fails the moment one does.

navFor(subject) (lib/admin/nav.ts) opens a folded item at the first tab the role may open by rewriting the item's href to that tab's href. isActive(item, pathname) then matches that rewritten href by prefix plus the item's also paths. For Members this is fine: the tabs are separate route roots (/admin/users, /admin/invites, /admin/affiliates) and also covers the siblings.

For an item whose tabs nest under the first tab's path — Rewind: /admin/rewind, /admin/rewind/playground, /admin/shares, /admin/rewind/settings — a role allowed only Playground and Settings would get href = /admin/rewind/playground, and /admin/rewind/settings would not light the item (the base prefix /admin/rewind/ is gone and is not in also).

Fix. When navFor rewrites href, keep the original href in also for that subject's copy of the item (or make isActive consult the item's children's hrefs as well as also). One unit test with a fixture role of that shape.


Generated by Claude Code

Activity

  1. added
    bug
    admin-ui
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    admin-uibug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions