Skip to content

The Per-Division Menu Access Map: One Nav Contract, Two Sources

Adityo Guni Waluyo

The generated manual index now answers which menus each account can open, with a two-source contract keeping the map in step with the live nav.

TL;DR

A generated manual index was missing access mappings showing which menus each account type could open. The team built filterable access cards into the generator, synchronized with navigation changes through a documented contract. Toggle chips with proper ARIA states keep six division cards scannable while meeting WCAG accessibility requirements.

The generated manual index opens with a tidy table: two dozen modules, documentation status, links to every page. The question arrived when a new division admin asked which menus their account could actually open. The table answers what exists, not who may see what. The access mapping was missing from the first place a person would look.

The first guess: add per-account explanations to every guide page. That means editing two dozen pages whenever the menu structure changes, and one forgotten page is enough to make the answers contradict each other. The problem was not documentation completeness; it was the absence of a single place mapping the live navigation to a per-account menu list.

The decision: build the access map into the manual generator's index. One section, one card per division plus a Super Admin card, rebuilt on every regeneration.

Each card carries menu rows: label, short function, and a link to the guide page when one exists. When it does not, the label renders as bold text with no link. No dead ends; the map states plainly that the guide for that menu has not been written. The mapping is curated from the nav contract in the admin layout file, including the Super-Admin-only menu list, then verified with a logged-in DOM session using one division's admin account. What the card says is what actually appears on that account's screen.

Two sources, one sync step

Once the map exists, the live nav and its static derivative become two sources for the same information. Two sources moving independently will contradict each other within weeks. The contract is now documented: every navigation change in the admin layout must carry the matching access-map update in the generator within the same commit. Synchronization is held by procedure; human memory is not used as the control.

Manual regeneration follows the same contract. The access cards are not hand-edited in generated files; they are rebuilt from curated mapping data maintained alongside the nav contract. A new panel menu that ships without a map update shows up as a diff at review time, not three months later through a user complaint.

The filter chip bar as a toggle-state problem

Six cards at once make visual scanning slow, so a chip bar sits above the grid: All, five divisions, and Super Admin. Chips like these are toggle buttons, and their state needs to be readable by machine and eye alike. The implementation attaches aria-pressed to a native <button> element. A native button already carries the implicit button role, so a single attribute is enough to turn it into a legitimate toggle button [1].

One trap avoided: the chip label never changes when pressed. The chip keeps reading the division name instead of switching to an active variant, because toggle-button guidance forbids changing label contents on state change [1]. Cards that fail the filter are hidden with the hidden attribute: browsers stop rendering elements carrying it and remove them from layout, without deleting a single card from the DOM [2].

A single event listener handles the whole chip bar through delegation:

chipBar.addEventListener('click', (e) => {
  const chip = e.target.closest('button[data-filter]');
  if (!chip) return;
  chipBar.querySelectorAll('button').forEach((b) =>
    b.setAttribute('aria-pressed', b === chip ? 'true' : 'false'));
  const f = chip.dataset.filter;
  cards.forEach((card) => {
    card.hidden = f !== 'all' && card.dataset.role !== f;
  });
});

The delegation works because closest() walks from the event target through its ancestors until a node matches the selector, returning null when nothing does [3]. One listener is registered on the bar, not one per chip [4].

Visual styling follows the same pattern as the rest of the manual: colors and borders come from CSS custom properties, values defined once and reused in many places [6]. Dark mode switches along automatically, because the chips carry no stubborn colors of their own.

What is guaranteed, and how

The principle behind these small details lives in WCAG 2.2 Success Criterion 4.1.2: a component's name and role must be programmatically determinable, and states that users can set must be programmatically set and announced to assistive technology [5]. A pressed chip announces itself as pressed; hidden cards drop out of the reading order. The map itself is guaranteed differently: the two-source contract keeps the static mirror from drifting away from the live nav, and the chip filter keeps six cards readable per role without losing their accessibility along the way.

Sources

  1. MDN Web Docs, aria-pressed
  2. MDN Web Docs, hidden attribute
  3. MDN Web Docs, Element.closest()
  4. MDN Web Docs, EventTarget.addEventListener()
  5. W3C, Understanding SC 4.1.2 Name, Role, Value
  6. MDN Web Docs, CSS custom properties

Related articles

Menu Access Map: One Nav Contract, Two Sources · Adityo GW