Skip to content

refactor(ui): adopt the priority+ tab pattern on Settings, Operations and NavBar (#1925) - #2781

Merged
vybe merged 6 commits into
devfrom
refactor/1925-overflowtabs-adoption
Sep 22, 2026
Merged

vybe merged 6 commits into
devfrom
refactor/1925-overflowtabs-adoption

Conversation

@dolho

@dolho dolho commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Stacked on #2780 (refactor/1924-confirmdialog-destructive) — review the diff of the last two commits, or rebase onto dev once #2780 lands.

Fixes #1925

What

Three audited surfaces hand-rolled a tab/nav strip instead of using the OverflowTabs primitive (#1114).

  • views/Settings.vue and views/Operations.vue render their tabs through the primitive.
  • components/NavBar.vue gets the same measured priority+ split without mounting it.

NavBar cannot mount OverflowTabs: the primitive's items are <button>s that emit a selection, and these are <router-link>s that must keep a real href (middle-click, Workspace's _blank, per-link active predicates, a per-link badge and a pill). So the fit arithmetic is shared instead — utils/overflowFit.js holds the rule verbatim from OverflowTabs::recompute, and both surfaces call it. Widening the primitive to render links would have meant a to/target/rel/custom-predicate/pill mode on a component five other strips already depend on.

Why NavBar was the worst case

Its link row was an overflow-x-auto scroller with the scrollbar suppressed inside the 64px bar (#1789). Links stayed reachable but became invisible and undiscoverable — the bar gave no signal that more navigation existed. It now renders what fits plus a counted "N more ▾", with the active state reflected on the trigger when the current route's link is one of the hidden ones, and the Operations badge riding along so a pending count is never hidden with its link.

Two pure modules, because the suite has no DOM

vitest runs environment: 'node' with no mount harness, so a rule inside an SFC is one no test can reach (the ent#392 precedent).

  • utils/overflowFit.js — the fit rule. Gained a gap term that NavBar needs and the tab strip does not: the tabs are padding-spaced, while the nav row carries a real flex gap that is invisible to the per-item rects. A gap-blind sum hides ~120px on a six-link row — one whole link — and so keeps the last one inline to clip.
  • utils/navLinks.js — the link set and its active/badge rules. A strip that can hide a link renders the same link three times (inline, menu, hidden mirror); three hand-written copies is three places for a predicate or a badge to drift.

Both are driven for real by overflowFit.spec.js (10 cases) and navLinks.spec.js (15). tabStripAdoption.spec.js is a ratchet only — it pins that the three surfaces stay wired and have not drifted back to a hidden-scrollbar scroller.

A source-text guard that had to be retargeted

workspaceNewTab.spec.js (ent#456) asserted target/rel against NavBar's template text. That truth moved into navLinks.js, so the NavBar half now drives the data — and additionally pins that the strip binds both fields onto its links, which is the half a data-driven refactor can get wrong: correct data that never reaches the DOM.

Triage of the audit's nine scanner candidates

Every one is a bounded wide table or a preformatted code block, where horizontal scroll inside the container is the correct treatment (design-system principle 7) — collapsing columns into a "More" menu would hide data, not navigation. None migrate; each is marked in place so a later audit does not re-flag it, and the ratchet fails if a marker disappears.

The advisory two-pill strip in Audit.vue is a segmented control — two short fixed labels in a panel header, selecting which chart the panel draws. It cannot overflow, and a "More ▾" over two items would hide one behind a click for no gain. Recorded as such rather than left unexplained.

Colours

New code is semantic-token only, so the nav's active underline moves from raw blue-500/400 to action-primary (the primitive's own active token) and the Enterprise PRO pill from raw purple-* to accent-purple-*. Visible as a slight indigo shift on the active indicator. Baseline: NavBar.vue raw_nongray 35 → 19, raw_gray 125 → 105 — edited by hand rather than regenerated, per the refrozen note (a wholesale run deletes that block).

The bug the suite could not catch

The first version hid four of five links at 1440px. The row and its parent cluster sized to content, so clientWidth reported the row's own min-content — near zero, since the inner nav is overflow-hidden — making the fit rule correct about a container that was lying to it. A row that scrolls sizes to its content; a row that collapses has to be told how much space it has. flex-1 on both supplies it (second commit).

Verification

Full frontend suite: 132 files, 2916 tests, all passing.

Against the local dev instance (this branch's bundle, real admin login), sweeping 1440 → 700 and back up:

width rows clipped trigger inline
1440–900 1 no — Dashboard · Library · Operations 16 · Settings · Workspace
800 1 no 2 more Dashboard · Library · Operations 16
700 1 no 3 more 16 Dashboard · Library
900 → 1440 (growing) 1 no — all five back inline

Settings collapses to More ▾ at 560 with General · Access · Integrations · MCP Keys inline; Operations collapses its own strip at 760. No strip wrapped to a second row or clipped at any width tested.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ

@dolho

dolho commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Review — /review pass

No critical findings. The part worth scrutiny is that NavBar does not mount the primitive but shares its arithmetic, so the two can drift — and the PR handles that correctly: computeInlineCount has one definition, both callers use it, and tabStripAdoption.spec.js pins that OverflowTabs still calls it rather than keeping a private copy. That is the right shape of guard for a shared rule.

Verified live rather than by reading (1440 → 700 and back): one row at every width, never clipped, collapsing at 800 and 700 and re-expanding on the way up; the counted trigger reads 3 more 16 when Operations is hidden and 2 more when it is not, so the badge follows its link into the menu instead of disappearing with it.

[I1] overflowNavBadgeCount reads as a sum but is a lookup (confidence 8/10)

NavBar.vue:

const overflowNavBadgeCount = computed(() =>
  overflowLinks.value.some((l) => l.badge) ? combinedOpsCount.value : 0
)

Correct today — Operations is the only badged entry — but the name and the position (beside overflowLinks) say "the badges that are hidden", while the body says "the ops count, if any hidden link happens to carry a badge". Add a second badged entry and the trigger silently reports the ops count for it. Either sum the hidden links' own badge values, or rename it to what it is (hiddenOpsBadge) and assert the single-badge assumption in navLinks.spec.js.

[I2] Prefix matching is documented in a test but not in the rule (confidence 6/10)

navLinks.spec.js pins that /librarian does not light Library and /library?tab=skills does — good, and it caught my own wrong assumption while writing it. But the behaviour lives in bare path.startsWith('/library') calls; a future entry whose slug is a prefix of another (/work vs /workspace) would light both with nothing to stop it. A one-line segment-boundary helper in navLinks.js would make the rule structural rather than incidental.

Checked and clean

  • The mirror row matches what the visible row draws. Badge and PRO pill are present in the mirror with the same padding and type scale, so a measured link is not narrower than it renders — the failure mode that makes a strip overflow one item too late.
  • The gap is accounted for. gap-3 xl:gap-6 is a real flex gap, invisible to per-item rects; reading columnGap off the mirror and passing it to the fit rule is correct, and overflowFit.spec.js covers the gap-blind case explicitly.
  • workspaceNewTab.spec.js was retargeted, not deleted. The ent#456 property (Workspace opens _blank with noopener) now runs against navLinks.js and asserts the strip binds :target/:rel onto its links — which is the half a data-driven refactor can get wrong.
  • Colour change is deliberate and tokenised: raw blue-500/400 → action-primary (the primitive's own active token), PRO pill → accent-purple. Baseline 35 → 19 / 125 → 105, hand-edited.
  • Triage is written down where the next audit will look: all nine overflow-x-auto candidates are bounded tables or <pre> blocks, marked in place, with the ratchet failing if a marker disappears.
  • Enum/value completeness: the link set is the only place link identity is defined, and all three render paths (inline, menu, mirror) consume it.

Note for the merge train

The sizing fix in the second commit (flex-1 on the row and its parent) is the load-bearing one — without it the strip hid four of five links at 1440px, correct arithmetic over a container that was lying about its width. Worth keeping the two commits distinct through the squash message.

@dolho

dolho commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

CI fix, pushed — and the break was mine.

e2e/navbar-overflow.spec.js is #1789's guard, and its third test asserts overflow-x: auto on the link row: the hidden-scrollbar scroller this PR deliberately replaces. It went red the moment the strip started collapsing. I missed it because I grepped src/ for that pattern when writing the triage and never e2e/ — the same search that produced the "nine candidates" list stopped at the source tree.

Attributed before fixing rather than assumed: the spec passes against plain origin/dev built and served the same way, and fails on this branch.

What changed. Properties 1 and 2 (links never collide with the controls; controls stay on-screen and the user menu stays hit-testable) are untouched and still pass — they were never about the mechanism. Property 3 now pins what this PR actually guarantees: links that fit render inline, the rest collapse into a counted "N more", the count agrees with what the menu holds, every hidden link carries a real href, and Escape closes it. It also pins the absence of the old mechanism — no overflow-x: auto, no scrollWidth past the box — because a future refactor reintroducing the scroll row would restore exactly the undiscoverable-link failure this issue removed.

settleNav is load-bearing, not politeness. The strip re-measures on a rAF after a resize, so a snapshot taken in the same tick as setViewportSize reports the previous split — "it fits" one frame before the links move into the menu. That is how my first version of this rewrite failed; the fix is to sample until two reads agree, not to widen a timeout.

Verified the rewrite is not vacuous: at 640px the trigger reads 4 more with 1 link inline and 4 in the menu; at 1440px there is no trigger and 5 links inline. So both branches of the fork are real on this fleet.

The stack (#2782 → #2787) was rebased onto this commit; each PR's own diff is unchanged (verified file/line counts before and after). All eight PRs are now green.

@dolho
dolho force-pushed the refactor/1924-confirmdialog-destructive branch from f70cc87 to 39bb7b1 Compare September 18, 2026 08:48
@dolho
dolho force-pushed the refactor/1925-overflowtabs-adoption branch from 4e6fff4 to 4458af1 Compare September 18, 2026 08:48
@dolho
dolho marked this pull request as ready for review September 18, 2026 08:48
@dolho

dolho commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

/review — post-rebase (stacked on refactor/1924-confirmdialog-destructive, 3 own commits)

Scope: CLEAN. Plan completion vs #1925: 5/5 done (Settings + Operations on OverflowTabs, NavBar priority+ with counted "More ▾" and no hidden scrollbar, 9 scanner candidates triaged with #1925 triage markers, fit rule shared via utils/overflowFit.js).

Rebase note: NavBar's baseline entry was re-measured on the tip — dev's ent#625 (35→23/125→113) and this branch's change compose to 7/93; scan-raw-colors.mjs confirms, _ent625_note preserved beside _1925_note. Ratchet green (3198 tests).

Critical

None.

Informational

  • [I1] _1925_note numbers are stale post-rebase (9/10) — note says NavBar.vue raw_nongray 35 -> 19 and raw_gray 125 -> 105; the entry now reads 7/93. Reword to 23 -> 7 / 113 -> 93 (after ent#625).
  • [I2] Overflow badge assumes the only badged link is Operations (7/10) — NavBar.vue overflowLinks.value.some((l) => l.badge) ? combinedOpsCount.value : 0; a second badged link later would mislabel. Derive from the hidden links' own badge values.
  • [I3] No unit case for the count === widths.length - 1 keep-inline branch with gap > 0 (6/10) — overflowFit.js:57-59; cheap to add.

Clean

rAF-coalesced resize with width-diff guard; listeners removed in onUnmounted; route-change watch uses route.value.fullPath correctly; _blank+noopener on all three link renders; buildNavLinks reproduces every prior link + active predicate.

@dolho

dolho commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

merge-train (#2896, dry run): pushed 1b080af7f to this branch — mechanical. CodeQL on the combined tree flagged js/incomplete-multi-character-sanitization on tabStripAdoption.spec.js's one-shot <!--…--> strip (alert 364); the strip now loops to a fixpoint, which is the shape the rule accepts. Behaviour unchanged, spec 18/18. This could not show on the PR itself: CodeQL does not run for a PR against a feature branch. Children re-stacked on the new tip.

@dolho

dolho commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

merge-train: pushed bb1b1018f to this branch — mechanical. The train (#2922's source-text ratchet + this stack) found the joint break: tabStripAdoption.spec.js reads 20 SFCs by text and is a NEW spec with no baseline entry, so the ratchet fails on the combined tree while each PR is green alone. It is a legitimate pin (an adoption guard over a set of call sites), so it now declares @source-text-pin with the reason; the docblock's 'node-only suite' sentence is rephrased. Downstream stack rebased.

dolho and others added 5 commits September 22, 2026 18:10
… and NavBar (#1925)

Three audited surfaces hand-rolled a tab/nav strip instead of using the
`OverflowTabs` primitive (#1114). Settings and Operations now render their tabs
through it; NavBar gets the same measured priority+ split without mounting it,
because its items are `<router-link>`s that must keep a real href and the
primitive's are `<button>`s that emit a selection.

NavBar is the case the audit called worst. Its link row was an `overflow-x-auto`
scroller with the scrollbar suppressed inside the 64px bar (#1789), so an
overflowed link stayed reachable but became invisible and undiscoverable — the
bar gave no signal that more navigation existed. It now renders the links that
fit plus a counted "N more ▾" disclosure, with the active state reflected on the
trigger when the current route's link is one of the hidden ones.

The fit arithmetic is SHARED, not re-derived: `utils/overflowFit.js` holds the
rule verbatim from `OverflowTabs::recompute`, and both surfaces call it. It also
gained a `gap` term, which NavBar needs and the tab strip does not — the tabs are
padding-spaced, while the nav row carries a real flex gap that is invisible to
the per-item rects, and a gap-blind sum hides ~120px on a six-link row (one whole
link) and so keeps the last one inline to clip.

Both new modules are pure because vitest runs `environment: 'node'` with no mount
harness, so a rule inside an SFC is one no test can reach (the ent#392
precedent). `utils/navLinks.js` likewise derives the link set once — a strip that
can hide a link renders the same link three times (inline, menu, hidden mirror),
and three hand-written copies is three places for an active predicate or a badge
to drift.

Colours: the new code is semantic-token only, so the active underline moves from
raw `blue-500/400` to `action-primary` (the primitive's own active token) and the
Enterprise PRO pill from raw `purple-*` to `accent-purple-*`. Visible as a slight
indigo shift on the nav's active indicator.

Triage of the audit's nine scanner candidates: every one is a bounded wide table
or a preformatted code block, where horizontal scroll inside the container is the
correct treatment (design-system principle 7) — collapsing columns into a "More"
menu would hide data, not navigation. None migrate; each is marked in place so a
later audit does not re-flag it. The advisory two-pill strip in Audit.vue is a
segmented control, a different primitive, and is recorded as such.

`workspaceNewTab.spec.js` (ent#456) asserted `target`/`rel` against NavBar's
template text; that truth moved into `navLinks.js`, so the NavBar half now drives
the data and additionally pins that the strip binds both fields onto its links —
the half a data-driven refactor can get wrong is correct data that never reaches
the DOM.

Baseline: NavBar raw_nongray 35 -> 19, raw_gray 125 -> 105. Edited by hand rather
than regenerated, per the `refrozen` note — a wholesale run deletes that block.

Fixes #1925

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ
Caught by a live check, not by the suite: at 1440px the strip hid four of five
links behind "4 more". The row and its parent cluster sized to content, so
`clientWidth` reported the row's own min-content — and because the inner nav is
`overflow-hidden`, that is near zero — making the fit rule correct about a
container that was lying to it.

The old #1789 row never needed this: a row that SCROLLS sizes to its content and
lets the overflow happen, while a row that COLLAPSES has to be told how much
space it actually has. `flex-1` on both supplies it; `justify-between` plus the
controls' `flex-shrink-0` keeps the right-hand cluster where it was.

Verified against the local dev instance across 1440/1300/1200/1100/1000/900/800/700
and back up again: one row at every width, never clipped, collapsing at 800 and
700 and re-expanding on the way back up.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ
…ll row (#1925)

`navbar-overflow.spec.js` is #1789's guard, and its third test asserts
`overflow-x: auto` on the link row — the hidden-scrollbar scroller this issue
deliberately replaced. It went red the moment the strip started collapsing, and
I missed it because I grepped `src/` for that pattern and never `e2e/`.

Confirmed it is this branch and not the tree: the spec passes against plain
`origin/dev` built and served the same way, and fails here.

Properties 1 and 2 — links never collide with the controls, controls stay
on-screen and the user menu stays hit-testable — are unchanged and still pass;
they were never about the mechanism. Property 3 now pins what #1925 actually
guarantees: the links that fit render inline, the rest collapse into a counted
"N more" disclosure, the count agrees with what the menu holds, every hidden
link is a real href, and Escape closes it.

It also pins the ABSENCE of the old mechanism — no `overflow-x: auto`, no
scrollWidth past the box. A future refactor reintroducing the scroll row would
restore exactly the undiscoverable-link failure this issue removed, and this is
where that gets caught.

`settleNav` is not politeness: the strip re-measures on a rAF after a resize, so
a snapshot taken in the same tick as `setViewportSize` reports the previous split
— "it fits" one frame before the links move into the menu. That is how the first
version of this rewrite failed, and the fix is to sample until two reads agree
rather than to widen a timeout.

Verified against this branch's build: 4/4 pass, and the collapsed branch is
genuinely exercised — at 640px the trigger reads "4 more" with 1 link inline and
4 in the menu, at 1440px there is no trigger and 5 links inline.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ
…anical, per the merge-train note on the PR

CodeQL js/incomplete-multi-character-sanitization (train #2896, alert 364)
flagged the one-shot replace in a source-text guard. A fixpoint loop is the
shape the rule accepts; behaviour on every real input is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…) — mechanical, per the merge-train note on the PR

The train (#2922's source-text ratchet + this stack) found the joint break:
this spec reads 20 SFCs by text and is a NEW spec with no baseline entry.
It is a legitimate pin — an adoption guard over a set of call sites a mount
cannot prove — so it declares itself one, per the ratchet's escape hatch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@vybe
vybe changed the base branch from refactor/1924-confirmdialog-destructive to dev September 22, 2026 17:11
@vybe

vybe commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

merge-train: rebased onto dev, retargeted, one mechanical fix pushed.

  1. git rebase --onto origin/dev e824ed247 (the pre-squash tip of refactor(ui): ConfirmDialog gains the keyboard contract, and two confirm() sites move onto it (#1924) #2780, now merged as 92d13fc) — the five refactor: adopt OverflowTabs for hand-rolled tab/nav strips (design-system p9/p10) #1925 commits replayed cleanly.
  2. Fix (from validation, verified against source): the Settings strip this PR deletes carried role="tablist" / role="tab" / :aria-selected; OverflowTabs.vue carried none, so all nine getByRole('tab', …) locators in e2e/settings-tabs.spec.js (Refactor Settings page with tabbed layout and absorb API Keys #302, @interactive, never in the @smoke tier CI runs) resolved to nothing. Added role="tablist" on the visible nav and role="tab" + :aria-selected="modelValue === tab.id" on the inline and overflow-menu tab buttons, in the primitive, so every consumer gains it. Locators untouched.
  3. The baseline's _1925_note still narrated NavBar 35 -> 19 / 125 -> 105; the entry holds 7 / 93 against dev's 23 / 113. Wording corrected.

Locally on the rebased tree: rawColorRatchet, loadingGateRatchet, tabStripAdoption, navLinks, overflowFit, workspaceNewTab — 73/73. Advisory notes from validation left for a follow-up: Operations.vue keeps a wrapper border-b under the primitive's own rule; its pending-count badges now render in status-success green.

@vybe
vybe force-pushed the refactor/1925-overflowtabs-adoption branch from bb1b101 to bc287f2 Compare September 22, 2026 17:12
…1925) — mechanical, per the merge-train note on the PR

The note narrated 35 -> 19 / 125 -> 105; the entry holds 7 / 93 against dev's 23 / 113 (post-rebase compose with ent#625).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@vybe
vybe force-pushed the refactor/1925-overflowtabs-adoption branch from bc287f2 to 1c10dd1 Compare September 22, 2026 17:24
@vybe

vybe commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

merge-train: the tab-role fix is reverted; #2960 tracks it. The e2e job went red on the retargeted run in three @smoke specs that locate tabs on other OverflowTabs consumers by getByRole('button', …) (smoke.spec.js:43 Operations, :46 Library, workspace-drafts.spec.js:151 chat tabs). role="tab" is therefore a primitive-wide convention change with a spec sweep behind it, not a mechanical restore — that is the author's call, filed as #2960. Pushed the branch again with only the _1925_note correction on top of the rebase; the five #1925 commits are untouched. The validation finding stands as a known, tracked a11y gap on Settings; it does not block the train since every other OverflowTabs consumer on dev already has the same shape.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: validated (lane B), rebased onto dev, all checks green on the retargeted run; the tab-role a11y finding is tracked as #2960.

@vybe
vybe merged commit 10d3d8a into dev Sep 22, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants