Repository navigation
feat(org-chart): add collapse/expand toggle to lead chips - #20194
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merge, check that [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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Before merge, confirm the narrow-width rail mask change ( Not justified as shipped
What this change shipsInventory (8 items) — 7 justifiedIntent: let a lead fold squad groups in the org-chart graph so they can scan several active squads. ADDITION (Closes #20186).
[FIRST-PRINCIPLES-REVIEWED] 3111c2d Description read[DESCRIPTION-READ] 5ba91de1117f377588f110851a36f4c72880e64301b8e60dadde32000f70a299 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS "Show 1 item" on an empty group opens only the "nothing dispatched" note, and the blind reader called that misleading. Watch
Suggestions
[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 |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
4e0089e to
205c895
Compare
45952a3 to
bb5683b
Compare
|
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. |
|
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. |
bb5683b to
3df3f27
Compare
|
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 |
|
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). |
|
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) |
|
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. |
|
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. |
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
2ee3e4f to
30682f4
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES at 30682f4.
- Wrong count for an empty group.
countVisibleRowsreturns 0 when a board has no tasks, butdrawKidsstill 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 ofcountVisibleRows, plus a test. - Rail regression.
.oc-kids-bodyaddsoverflow: hidden. That clips the last child's:aftermask atleft: -12px, which sits on the border column, so the rail runs past the last elbow in every expanded group. Droppingoverflow: hiddenfrom.oc-kids-bodyshould be enough, since the outer.oc-kidsalready clips. - 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 pleasegit rmthem. Two of them also show the old 'Show 8' / 'Show 4' labels. - 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)
30682f4 to
8487587
Compare
|
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)
Opus 5.5 Review
UX ReviewWatch:
Suggestion:
Items deferred on earlier heads:
First Principles Review (CONCERNS)Both items are kept, and the Goal is unchanged.
Design Review (PASS)
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.
8487587 to
3111c2d
Compare
|
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
UX Review (CONCERNS)
First Principles Review (CONCERNS)
|
|
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), |
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
allow-same-originin the sandbox; in-memory reset on reload is the right tradeoff).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:var foldState = {}sits at the IIFE scope (outsiderender()), so a fold survives the host'smessagere-renders and resets on reload. Each sub-lead has its own key (parentGroupKey + NUL + item_id), so groups fold independently.foldControl(chip, kids, body, key, countFn, onToggle)adds a<button class="oc-fold">witharia-expanded,aria-controlsandaria-labelto lead and sub-lead chips. Itstitlesays the collapse is graph-only: "Collapses this group in the graph only. The cards below stay."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..oc-kidsis a grid whose row animates1fr -> 0frin 0.2s, andprefers-reduced-motioncuts straight to the end..oc-kidsclips 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 atleft: -10pxto follow the narrower padding.transitionendsetshiddenon a folded body. Opening clearshiddenfirst and removes the closed class one frame later. With reduced motion both happen at once.--oc-doneat 11px.:hovermakes the pill stronger and:focus-visibleadds a 2px ring, so after a mouse click the button looks as it did before the click once the pointer moves away.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.fold_hide,fold_show,fold_show_oneandfold_hintinenandzh-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 outsiderender(), 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, thefold_hinttitle 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.pybuild_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 tosample_timeline.json:hidden, animated and withprefers-reduced-motion: reduce. Reopened, it is back to its full height. Frames taken during the animation show nothing drawn outside the group's box.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.
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.
A sub-lead folded: "Show 4 items" (its ITS BOARD chip and 3 workers).
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".
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.
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.
Related Issues
Closes #20186
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)