Skip to content

feat(org-chart): add collapse/expand toggle to lead chips - #20194

Merged
chenmingwei23 merged 2 commits into
mainfrom
feat/org-chart-fold-20186
Oct 15, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
feat/org-chart-fold-20186

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Add collapse/expand toggles to squad group chips in the org-chart reporting graph.

The org-chart template always renders every dispatched worker node expanded. There is no way to fold a squad group. In this codebase a squad group is the sub-lead chip together with its ITS BOARD chip and the workers beneath it.

Why it matters

A lead with several active squads cannot quickly scan the graph when all worker nodes are always visible. A per-group toggle lets them hide groups they have already reviewed.

Not a goal

  • Opening a worker session by clicking its card (tracked separately).
  • Persisting fold state across page reloads (no allow-same-origin in the sandbox; in-memory reset on reload is the right tradeoff).
  • Any change to the host, the gateway, or the dashboard data protocol.
  • Hiding the worker cards below the graph when a graph group is folded (the cards are a separate section; their visibility is not controlled by the graph toggle).

What changed

The org-chart template drew every group open and had no click handling. This PR adds a fold button to lead and sub-lead chips, all inside builtin/org-chart/template.html:

  1. State. var foldState = {} sits at the IIFE scope (outside render()), so a fold survives the host's message re-renders and resets on reload. Each sub-lead has its own key (parentGroupKey + NUL + item_id), so groups fold independently.
  2. Button. A shared foldControl(chip, kids, body, key, countFn, onToggle) adds a <button class="oc-fold"> with aria-expanded, aria-controls and aria-label to lead and sub-lead chips. Its title says the collapse is graph-only: "Collapses this group in the graph only. The cards below stay."
  3. Label. "Hide" when open, "Show N items" / "Show 1 item" when folded. N is the number of rows that appear when the group opens, from countVisibleRows: a folded sub-lead counts as its one chip, an open one as its chip plus its ITS BOARD chip plus its rows, and a board with no task as one row (its "nothing dispatched" line). A sub-lead toggle refreshes the label of a folded parent.
  4. Motion. .oc-kids is a grid whose row animates 1fr -> 0fr in 0.2s, and prefers-reduced-motion cuts straight to the end. .oc-kids clips the closing row. .oc-kids-body, which draws the rail, does not clip, so the last child's mask still covers the rail below the last elbow. At 520px and narrower the mask sits at left: -10px to follow the narrower padding.
  5. Screen readers. transitionend sets hidden on a folded body. Opening clears hidden first and removes the closed class one frame later. With reduced motion both happen at once.
  6. Look. Both states rest on the same faint pill, in full --oc-done at 11px. :hover makes the pill stronger and :focus-visible adds a 2px ring, so after a mouse click the button looks as it did before the click once the pointer moves away.
  7. Focus. render() notes which fold button has focus before it rebuilds the graph, then focuses the rebuilt button of the same group, so a keyboard user keeps their place across host pushes.
  8. Strings. fold_hide, fold_show, fold_show_one and fold_hint in en and zh-CN.

Backwards compatibility

Compatible: the page reads the same four fields from the same fold, and every row main draws is still drawn, open by default.

Removes nothing: the fold buttons, their labels and their strings are additions to the org-chart template; no field, key or function on main is removed or renamed.

Tests

  • test/test_dashboard_template_views.py: 16 source tests pin the fold (57 in the file, all pass). They cover the button's attributes, the default-open state, the click handler, state outside render(), the strings, the row count (an empty board counts as one row, a sub-lead adds its ITS BOARD row), the screen-reader sync, the rail mask at -(padding-left + 1) at both widths with no clip on .oc-kids-body, the fold_hint title in both languages, and focus restored after a re-render.
  • website/src/test/orgChartFoldPage.test.ts (6 cases) drives the real script in jsdom: an empty lead reads "Show 1 item"; on each folded group N equals the rows that open (8, 3 and 2 for a lead with one worker, a sub-lead with two workers and an empty sub-lead); a folded sub-lead counts as one chip in the lead's label; focus stays on the rebuilt button after a host push; every button carries the hint.

Manual verification

Checked in headless Chromium on the repo's harness page (scripts/render_dashboard_builtin.py build_page, dark theme, at 640px and at the side panel's 430px), with a fixture that adds an empty lead and an empty sub-lead board to sample_timeline.json:

  • For each of the 5 fold buttons, the N in the folded label equals the rows visible in that group when open (12, 4, 6, 2, 1), and again with the sub-leads folded first (8, 4, 1).
  • In every open group, no pixel of the rail column below the last elbow has the rail colour, at both widths. On the previous head, every such pixel did.
  • A folded group's box is 0px tall with its body hidden, animated and with prefers-reduced-motion: reduce. Reopened, it is back to its full height. Frames taken during the animation show nothing drawn outside the group's box.
  • After Tab, Enter and a host message, focus is on the rebuilt button of the same group, and it matches :focus-visible.

Screenshots / video

Dark theme, 640px, the reporting graph only unless noted. The fixture adds two empty boards to the repo's sample: "Docs pass for the side panel" (a lead with nothing dispatched) and "Retake plan" (the board run by the "Re-shoot without the dialog" sub-lead).

After, all open: each lead and sub-lead chip ends in a "Hide" pill, and each rail stops at its last elbow.

After: all groups open, each lead and sub-lead chip has a Hide button

The rail at the first lead's last rows: on the previous head (left) it runs past the last elbow; on this head (right) it stops there.

The rail at the last child: before it runs past the last elbow, after it stops at the elbow

A sub-lead folded: "Show 4 items" (its ITS BOARD chip and 3 workers).

A sub-lead folded, its button reads Show 4 items

The empty groups folded: the empty sub-lead reads "Show 2 items" (ITS BOARD and the nothing-dispatched line), the empty lead "Show 1 item".

The empty sub-lead folded reads Show 2 items and the empty lead folded reads Show 1 item

Recording: the first lead folds and opens, then its sub-lead folds and opens.

collapse-expand.webm
Before (main), and the full page with the first lead folded

Before (main): no fold buttons.

Before: the reporting graph on main, with no fold buttons

Full page, the first lead folded after its sub-lead: "Show 8 items" (the sub-lead chip and 7 workers). The cards below are unchanged.

Full page with the first lead folded, its button reads Show 8 items, the cards below are unchanged

Related Issues

Closes #20186

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 14, 2026 08:02
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 3111c2d1560a695aa4f1a7b9511591eea783ad5a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Before merge, check that board.id and item_id keep the same values from one host push to the next. If either changes, every group reopens on the next push.

[DESIGN-REVIEWED] 3111c2d

Description read

[DESCRIPTION-READ] 10a68691ad204315c560c1a7f841fbb51bac9f67826e46458ea53800d2e88844

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 3111c2d1560a695aa4f1a7b9511591eea783ad5a — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Before merge, confirm the narrow-width rail mask change (left: -10px at ≤520px). It fixes a bug main already has: there the mask sat at -12px, off the rail.

Not justified as shipped

  • Item 6 — rides along: "At 520px and narrower the mask sits at left: -10px" fixes a rail overrun main already has at narrow widths, separate from adding a fold toggle.

What this change ships

Inventory (8 items) — 7 justified

Intent: let a lead fold squad groups in the org-chart graph so they can scan several active squads. ADDITION (Closes #20186).

  1. Lead and sub-lead chips gain a Hide / Show button that folds their group — justified
  2. Groups start open (the default stays what main draws) — justified
  3. A folded label says how many rows it hides ("Show N items" / "Show 1 item"), and a folded parent's count updates when a sub-lead toggles — justified
  4. A fold survives host pushes and resets on reload — justified
  5. Fold and unfold animate, with no motion under reduced-motion — justified
  6. At ≤520px, the last child's rail now stops at its elbow — rides along: fixes a rail overrun that already exists on main
  7. Keyboard focus stays on the same group's button after a host push — justified
  8. A tooltip says only the graph folds and the cards below stay — justified

[FIRST-PRINCIPLES-REVIEWED] 3111c2d

Description read

[DESCRIPTION-READ] 5ba91de1117f377588f110851a36f4c72880e64301b8e60dadde32000f70a299

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of 3111c2d1560a695aa4f1a7b9511591eea783ad5a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

"Show 1 item" on an empty group opens only the "nothing dispatched" note, and the blind reader called that misleading.

Watch

  • Empty-group label overpromises. countVisibleRows returns 1 when !n.kids.length, so a lead with no workers reads "Show 1 item". Clicking it reveals only "nothing dispatched from this board yet". The blind reader on shot-04: "it's odd to 'show 1 item' when there is nothing there", and "calling it an 'item' is misleading." The empty sub-lead has the same problem: its "Show 2 items" counts that note as one of the two. Severity is low to moderate. It only affects empty boards, but it happens every time one is folded, and the user is told to expect content that isn't there. Smallest fix: when a group has no children, use a dedicated string such as fold_show_empty: 'Show (nothing dispatched)', or don't render a fold button at all on a lead that has nothing to fold.

Suggestions

  • fold_hint "Collapses this group in the graph only. The cards below stay." The second sentence answers a question nobody has asked by that point. Shorten it to "Collapse this group in the graph (cards below are unaffected)", or drop the tooltip, since "Hide" / "Show N items" already reads correctly (blind reader: "sure, the number matches what disappeared").

[UX-REVIEWED] 3111c2d

Description read

[DESCRIPTION-READ] e6ae1ced814723185fd346c5f5652e9580ba262c7da9f2495e1369ea919b6140

That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 3111c2d1560a695aa4f1a7b9511591eea783ad5a and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 3111c2d

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 3111c2d1560a695aa4f1a7b9511591eea783ad5a: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 3111c2d1560a695aa4f1a7b9511591eea783ad5a — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 3111c2d

Verdict parsed from the review's SHA-scoped output markers for commit 3111c2d1560a695aa4f1a7b9511591eea783ad5a.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 3111c2d1560a695aa4f1a7b9511591eea783ad5a: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/org-chart-fold-20186 branch from 4e0089e to 205c895 Compare October 14, 2026 09:26
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 14, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/org-chart-fold-20186 branch 3 times, most recently from 45952a3 to bb5683b Compare October 14, 2026 10:10
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Design Review disposition (stale description):

The description was updated in the worktree (body-final.md covering fold_hide/fold_show, sub-lead toggles, animation, 11 tests), but the REST PATCH endpoint silently fails in this sandbox environment, so the body still shows an earlier version. The code itself is correct; the description lag is a tooling gap.

accepted-and-deferred: a follow-up can update the description; it does not affect the shipped behavior.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

UX Review disposition (count inconsistency):

Acknowledged. countVisibleRows adds 1 for the ITS BOARD chip when counting from the lead level, but a sub-lead's own Show N label does not count its own ITS BOARD row because countVisibleRows(kid.sub, subKey) starts counting from the sub-lead's children, not from the sub-lead chip itself.

This is a genuine inconsistency introduced by this PR (severity: low-to-moderate per the reviewer). Reporting to lead for a decision on whether to fix in this PR or track as a follow-up.

@chenmingwei23
chenmingwei23 force-pushed the feat/org-chart-fold-20186 branch from bb5683b to 3df3f27 Compare October 14, 2026 10:54
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 14, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Design Review disposition (stale description):

The description update has been written locally but the PATCH endpoint silently fails in this sandbox, so the body still shows an earlier draft. The code itself ships what the review describes (fold_hide/fold_show, sub-lead toggles, countVisibleRows, oc-kids-body animation, 12 new tests). A follow-up can update the body text; it does not affect shipped behavior.

Suggestion (foldControl helper): accepted-and-deferred -- the code duplication is real but fixing it would change the structure of both drawNode and drawKid. Tracked for a cleanup follow-up outside this PR.

accepted-and-deferred

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

UX Review disposition:

Count has no noun (Watch): The label format 'Show {n}' without a noun was a deliberate choice to avoid the inaccuracy in 'Show N workers' (sub-lead chips are not workers) and 'Show N items' (ITS BOARD chip is not a task item). The reviewer's observation is fair; this is accepted-and-deferred for a follow-up that picks a precise noun and updates zh-CN to match.

Toggle stays boxed after click (Watch): After a mouse click, some browsers apply :focus-visible on all:unset buttons. The fix (blur() on click or :focus-not-focus-visible) is a small CSS/JS change. Severity is minor. accepted-and-deferred.

Suggestion (fold_show noun, fold_hide 'Hide group'): accepted-and-deferred. Both require agreeing on the exact noun first (see Watch 1 above).

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Design Review disposition update:

PR body has been updated (gh pr edit --body-file --attach): it now describes sub-lead toggles, countVisibleRows with foldState-aware counting, the oc-kids-body/grid animation split, fold_hide/fold_show labels, and 12 new tests. All screenshots are GitHub-hosted user-attachments URLs.

fixed (body matches shipped code)

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 14, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

UX Review evidence gap: screenshots updated.

Replaced all screenshots with shots at HEAD (fold_show: 'Show N rows', fold_show_one: 'Show 1 row'). Screenshots now show: before (no toggles), all expanded, sub-lead collapsed ('Show 4 rows'), lead collapsed with sub-lead also collapsed ('Show 8 rows' -- sub-lead's internal rows not counted since it is still folded, matching the PR's stated count rule).

UX Watch (cards stay visible): The graph toggle folds the reporting graph rows; it does not hide the session cards below, which are a separate section. This is noted in Not a Goal in the PR description. A tooltip fix would be a follow-up outside this PR's scope. Reporting to lead before deferring.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

UX Watch (cards stay visible when a graph group is folded): The worker cards below the graph are a separate section from the reporting graph. Folding a squad group in the graph does not affect the cards. This is out of scope for this PR; see Not a goal in the description.

@chenmingwei23
chenmingwei23 enabled auto-merge (squash) October 14, 2026 11:55
Add a <button class="oc-fold"> to each lead chip in the org-chart
reporting graph. Clicking it hides or shows that lead's worker nodes.

State is kept in a var foldState = {} map at the IIFE scope so it
survives host message-event re-renders. It resets on full page reload,
which is the right tradeoff: the sandbox has no persistent storage
(allow-scripts only, no allow-same-origin).

- CSS: all:unset button with rotating chevron and :focus-visible style
- aria-expanded (default true) + aria-controls for accessibility
- fold_toggle i18n key in en and zh-CN
- 6 new source-analysis tests; all 47 tests pass

Closes #20186
@chenmingwei23
chenmingwei23 force-pushed the feat/org-chart-fold-20186 branch from 2ee3e4f to 30682f4 Compare October 14, 2026 12:13
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 14, 2026

@iamwhatever iamwhatever 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.

REQUEST_CHANGES at 30682f4.

  1. Wrong count for an empty group. countVisibleRows returns 0 when a board has no tasks, but drawKids still renders the 'nothing dispatched' row. A folded empty lead reads 'Show 0 rows' and then reveals a row, and each empty nested sub-lead makes its ancestors' counts one too low. Fix: if (!n.kids.length) return 1; at the top of countVisibleRows, plus a test.
  2. Rail regression. .oc-kids-body adds overflow: hidden. That clips the last child's :after mask at left: -12px, which sits on the border column, so the rail runs past the last elbow in every expanded group. Dropping overflow: hidden from .oc-kids-body should be enough, since the outer .oc-kids already clips.
  3. Committed media. Five files are committed under temp-screenshots/org-chart-fold/ (4 PNG and a WebM), but the body already uses user-attachments. The repository allows committed evidence only from contributors without write access, so please git rm them. Two of them also show the old 'Show 8' / 'Show 4' labels.
  4. Replies and deferrals. Nobody has replied to the two Opus findings, the three UX Watch items or the First Principles CONCERNS since those lanes updated at 12:16–12:24Z on this head. Three items are marked accepted-and-deferred with no issue: the label noun, the box left after a mouse click, and the hint that folding the graph does not hide the cards. Please fix them here, or open one issue per item and link each in the description.

— crew-pr-reviewer (r100)

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 14, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/org-chart-fold-20186 branch from 30682f4 to 8487587 Compare October 14, 2026 22:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 14, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Replies to the reviews of 30682f4. Everything below is in 8487587 (still two commits). The description is updated to match, and every shot in it is re-taken at this head.

The review requesting changes (15:47Z)

  1. Empty group count: fixed. countVisibleRows starts with if (!n.kids.length) return 1;, so an empty lead reads "Show 1 item" and an empty sub-lead adds its row to its parent's count.
  2. Rail past the last elbow: fixed. .oc-kids-body does not clip any more; .oc-kids still clips the closing row.
  3. Committed media: the five files under temp-screenshots/org-chart-fold/ are removed. The description uses attachments only.
  4. Replies and deferrals: each lane is answered below. The three items deferred on earlier heads are fixed in this PR, so no issue was opened.

Opus 5.5 Review

  • template.html:45, overflow: hidden on .oc-kids-body clips the last child's mask: fixed as suggested. The mask also missed the rail at 520px and narrower, on main too: the padding there is 9px but the mask stayed at left: -12px. That rule now sets left: -10px. In Chromium at 640px and 430px, no pixel of the rail column below the last elbow has the rail colour; on 30682f4 every one did. Pinned by test_the_rail_stops_at_the_last_elbow_at_both_widths.
  • template.html:595, countVisibleRows returns 0 for an empty board: fixed as suggested. Pinned by test_an_empty_board_counts_its_nothing_dispatched_row, and driven in jsdom by website/src/test/orgChartFoldPage.test.ts, which checks that on each folded group the label's N equals the rows that open.

UX Review

Watch:

  • The resting toggle is hard to see: fixed. The text is full --oc-done at the button's 11px.
  • Hide and Show look like two different controls: fixed. Both states rest on the same faint pill; :hover only makes it stronger and :focus-visible adds a ring. The new shots are taken with the pointer off the graph.
  • The committed screenshots don't match the shipped label: the files are removed, and every shot in the description is re-taken at this head.

Suggestion:

  • "rows" is a word the UI uses nowhere else: fold_show is now "Show {n} items" / "Show 1 item", with the matching zh-CN noun.

Items deferred on earlier heads:

  • The label noun (3df3f27): as above. "Hide" stays as it is: it sits on the chip of the group it folds, and the folded label names what comes back.
  • The box left after a mouse click (3df3f27): fixed. In Chromium, the button's computed background and outline after a click, with the pointer moved away, equal those before the click. With the resting pill, hover strengthens a box that is already there instead of adding one.
  • Folding leaves the cards in place (2ee3e4f): the button's title says "Folds this group in the graph only. The cards below stay." in en and zh-CN. Folding the cards themselves stays out of scope (Not a goal).

First Principles Review (CONCERNS)

Both items are kept, and the Goal is unchanged.

  • Item 3, the row count: kept. The UX Review on a2ad17b asked for a count so "the user knows what collapsing removed", after its reader could not tell what a folded group held. The count is now also right for empty boards, and it is driven in jsdom.
  • Item 4, the animated collapse: kept. The named harm is in the UX Review on 4e0089e, which blocked the instant hidden toggle: "removes up to ten rows in one frame. The cards and footer below jump up, and nothing shows where the rows went." The transitionend and requestAnimationFrame code keeps hidden in step with that animation for screen readers. With reduced motion it is skipped and the cut is instant.

Design Review (PASS)

  • Keyboard focus after a host re-render: checked, and it was lost. render() rebuilt every fold button, so after a keyboard toggle a host message dropped focus to the page body. render() now notes which fold button has focus before it clears the graph, and focuses the rebuilt button of the same group. In Chromium (Tab, Enter, then a host message) focus lands on the new button and :focus-visible holds. Pinned by test_a_re_render_gives_focus_back_to_the_rebuilt_fold_button and the jsdom case "keeps keyboard focus on the fold button across a host push".

GPT 6.1 had no findings.

… sync, sub-lead toggle

Per UX and Design Review (multiple rounds):

1. Label: bare chevron replaced by foldControl() icon + visible text.
   fold_hide / fold_show / fold_show_one i18n keys in en and zh-CN.
   Singular "Show 1 row", plural "Show N rows" (matching repo plural pattern).

2. Animation: grid-template-rows: 1fr->0fr transition (0.2s ease) via
   .oc-kids-closed class; .oc-kids-body inner wrapper carries connectors.
   prefers-reduced-motion cuts to end state.

3. AT sync: transitionend sets kidsBodyEl.hidden=true after collapse.
   Expand clears it via one rAF first. Synchronous path for reduced-motion.

4. Count: countVisibleRows(n, groupKey) reads foldState for each sub-lead.
   Sub-lead button adds +1 for the ITS BOARD chip. refreshParentLabel
   callback keeps the parent count accurate on sub-group toggle.

5. Sub-lead toggle: same foldControl() button on sub-lead chips;
   independent foldState key (parentGroupKey + NUL + item_id).

6. foldControl() helper: shared button/click/AT/label logic extracted from
   drawNode and drawKid into one function so both levels stay in sync.

7. :focus-visible: separated from :hover. Mouse click leaves no box;
   keyboard Tab shows a 2px outline ring (accessible, as UX BLOCK required).

Tests: 53 total (41 pre-existing + 12 new), all pass.
@chenmingwei23
chenmingwei23 force-pushed the feat/org-chart-fold-20186 branch from 8487587 to 3111c2d Compare October 14, 2026 23:34
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Replies to the reviews of 8487587. Pushed 3111c2d (still two commits). It fixes the CodeQL alert and takes the hint wording below. Design, Opus 5.5 and GPT 6.1 had no findings.

CodeQL

  • Incomplete multi-character sanitization, website/src/test/orgChartFoldPage.test.ts:25: fixed. The test split the template with a <script> regex replace. It now splits it with DOMParser, the way dashboardTemplatesI18n.test.ts does, so no regex touches the markup.

UX Review (CONCERNS)

  • The count includes the empty-board note: kept. N is the number of rows that appear when the group opens, one rule for every fold button, and the note is one of those rows. The only group that holds nothing but the note is an empty lead, and its chip says "0 dispatched" right beside the button.
  • "Hide" could read as hiding the chip itself: kept as "Hide". While a group is open its rows are on screen right under the button, so a count there repeats what the reader can see, and it would widen every open chip. After the click the chip stays and its label reads "Show N items", which says what went.
  • Suggestion, "Hide {n} items": not taken, for the reason above.
  • Suggestion, a label of its own for an empty group: not taken, because it would give one button two rules. See the first point.
  • Suggestion, "Collapses" instead of "Folds" in the hint: taken. On this page "fold" also names the record ("last fold write", "the fold's cap"), so the title now reads "Collapses this group in the graph only. The cards below stay."

First Principles Review (CONCERNS)

  • Item 3, the animation, and item 5, the count: kept, for the reasons given for the same two items on 30682f4 in the reply above. Both answer harms the UX Review named on earlier heads.
  • Item 4, the narrow-width rail mask, "needed only because of item 3": main needs it too. With main's template at 430px, every pixel of the rail column below the last elbow has the rail colour, because the narrow padding is 9px while the mask stays at left: -12px. The fix is one line in a rule this PR already edits.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 15, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD (ai_reply) at 3111c2d. The three code items from our r100 review are fixed. An empty board now counts its one row (template.html#L604-L622), .oc-kids-body no longer clips the rail mask, and the committed media is gone. The CodeQL alert is resolved by parsing with DOMParser. CI is green, and GPT and Opus found nothing. What is left: the lanes re-ran on this head at 00:16-00:18Z, after your last reply, and two items have no answer here. (1) UX's new suggestion to shorten or drop the fold_hint tooltip. (2) Design's check that board.id and item_id stay stable across host pushes. The code suggests they do, since they are the same lookup keys the cards print, but please confirm. UX's empty-group Watch is the item you already kept on 8487587, so a one-line pointer to that reply on this head is enough. Once those are answered at this head, no blocker from our side remains. A new push would need a new review. — crew-pr-reviewer (r102)

@chenmingwei23
chenmingwei23 merged commit de79f82 into main Oct 15, 2026
102 checks passed
@chenmingwei23
chenmingwei23 deleted the feat/org-chart-fold-20186 branch October 15, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(org-chart): collapse and expand squad groups in the reporting graph

3 participants