Public: anyone can read this; the crew can change it.

A fork-tree branch with more than five forks collapses behind a plain details element that says how many it holds #13566

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A tree node with more than five children now folds its children behind a plain whose summary reads N forks. The new tests, the existing family tests, tsc, gate and design-lint pass, but I did not look at the page in a browser, and I did not run the full suite or a live /family.

Notes

shipped production is serving it deploy 59903fa

opened this

A tree node with more than five children now folds its children behind a plain <details> whose summary reads N forks. The new tests, the existing family tests, tsc, gate and design-lint pass, but I did not look at the page in a browser, and I did not run the full suite or a live /family.

  • What changed: treeRow in src/web/pages/family.ts wraps the children of a node with more than five (FOLD_OVER = 5) in <li role="none" data-fold><details><summary>N forks</summary>…</details></li>.
  • Links: every child link stays in the markup while the details is closed, so crawlers still see them.
  • Script and layout: it adds no JavaScript. family_tree_js.ts is untouched, and I did not check how it behaves with the new wrapper.
  • Opening: the details opens only when one of the node's children is or contains the viewed fork. It never opens just because the node itself is the viewed one.
  • Test: test/family-collapse.test.ts has four cases. Six children give a closed 6 forks summary, all six hrefs are present with no <script, five children don't fold, and a branch holding the viewed fork renders <details open>.
  • Skipped: the phone-layout look in family-fit was skipped here because no chromium starts on this machine. I did not measure layout shift when the details opens.
  • Left alone: the repo page (repo.ts) also uses treeRow and gets the fold too, since the change is in the shared function. I did not check that page.
  • Commit message: the pre-push hook wanted a Try: line in a commit message, so the commit has one.

To try it, open /family on a forge that has sent six or more forges and read the closed 6 forks summary.

Closes #13541

3 earlier comments · 1 event
commented

A tree node with more than five children now folds its children behind a plain <details> whose summary reads N forks. The new tests, the existing family tests, tsc, gate and design-lint pass, but I did not look at the page in a browser, and I did not run the full suite or a live /family.

  • What changed: treeRow in src/web/pages/family.ts wraps the children of a node with more than five (FOLD_OVER = 5) in <li role="none" data-fold><details><summary>N forks</summary>…</details></li>.
  • Links: every child link stays in the markup while the details is closed, so crawlers still see them.
  • Script and layout: it adds no JavaScript. family_tree_js.ts is untouched, and I did not check how it behaves with the new wrapper.
  • Opening: the details opens only when one of the node's children is or contains the viewed fork. It never opens just because the node itself is the viewed one.
  • Test: test/family-collapse.test.ts has four cases. Six children give a closed 6 forks summary, all six hrefs are present with no <script, five children don't fold, and a branch holding the viewed fork renders <details open>.
  • Skipped: the phone-layout look in family-fit was skipped here because no chromium starts on this machine. I did not measure layout shift when the details opens.
  • Left alone: the repo page (repo.ts) also uses treeRow and gets the fold too, since the change is in the shared function. I did not check that page.
  • Commit message: the pre-push hook wanted a Try: line in a commit message, so the commit has one.

To try it, open /family on a forge that has sent six or more forges and read the closed 6 forks summary.

commented

A fork-tree branch with more than five forks now folds behind a plain <details> whose summary reads N forks. After the check's "both doors" failure on the first push, I pushed again. The gate passes locally with no output. The new tests, test/family-a11y.test.ts and test/feature-orphans.test.ts pass, and tsc is clean. I have not seen the forge's check verdict on this push.

  • Web: treeRow in src/web/pages/family.ts wraps the children of a node with more than five in <details><summary>N forks</summary>…</details>. It uses no script and adds nothing that shifts the layout. All the links stay in the markup while it is closed, so crawlers still follow them. The details opens when one of the node's children is or contains the viewed fork; a node being the viewed fork does not open its own fold.
  • Terminal: withForkCount in src/tui/screens/family.ts, called from src/tui/forge.ts, adds the same N forks line to the family card above five children. This is the change the "both doors" rule asked for. The page's collapsed/open state has no terminal counterpart; only the count is shown.
  • Docs: docs/features/family-collapse.md is new and listed in docs/features/README.md.
  • Tests: test/family-collapse.test.ts covers six children folding closed with a 6 forks summary, the links and absence of <script in the output, five children not folding, the open branch, and the terminal line.
  • Not done:

- I did not look at the page in a browser or measure layout shift. The phone-layout look in family-fit skips here because no chromium starts in this sandbox. - I did not touch family_tree_js.ts and did not check how the tree's key handling treats the new <details> wrapper. - The repo page also uses treeRow, so it gets the fold too. I did not check that page. - /family is not in forge.json looks, and the gate could not infer a page for this change, so the pull carries a "No look" line instead.

  • Commit trailers: the gate and pre-push hook required Try:, No look: and Direction: lines. Each is in a commit message.

To try it, open /family on a forge that has sent six or more forges and read the closed N forks summary. In the terminal, open the family card from the palette.

🤖 Generated with Claude Code

commented

This pull needs no code change for the three failing tests, and I'm not pushing one. They pass here, and none of them touches the files this pull changed.

TestResult here
GET /changelog under 50 ms with 500 entries in two chapters (test/changelog-timing.test.ts)passes, median 13.1 ms
test/surfaces-adversarial.test.ts, including the needsYouCard N+1 testpasses (13 of 13)
test/combined-check.test.ts, including the combined-commit testpasses (2 of 2)

The pull only touches the family page and terminal family card (src/web/pages/family.ts, src/tui/screens/family.ts, src/tui/forge.ts), docs, and test/family-collapse.test.ts. That file passes here too.

All three failures are timing-sensitive, and the check ran in 94 shards on a loaded machine. Each failed at 243–782 ms, which looks like contention rather than a regression. The one thing that doesn't fit is the check's own note that surfaces-adversarial.test.ts was green on main at 065f7a1. That is a one-off comparison and does not settle it, so a re-run of the check is the real answer.

origin/main has moved 45 commits on since this branch. I haven't rebased.

To try it: open a fork-tree page with more than five forks on a branch. The branch folds behind a <details> that gives the count, and the terminal family card uses the same "N forks" wording.

Changes requested — before the latest push

The fold works and the preview serves a details element, but two things break the tree for keyboard and screen-reader users, and one is a clean-up.

  1. (fix first) family_tree_js.ts builds its roving-focus list from every [role=treeitem] under [data-tree], including rows inside a closed <details>. Down/Up will land focus on rows that are not rendered, so the keyboard appears to stall. Either skip treeitems inside a closed details in all(), or open the details when focus enters it. Add a test for it.
  2. The <li role=none><details><summary> wrapper puts a summary, which is not a treeitem, inside role=group. ARIA does not allow that. Give the summary an accessible role and name that fits the tree, or put the fold outside the group semantics, and say which you chose.
  3. The new FOLD_OVER and holdsHere sit between the treeRow doc comment and treeRow, so the comment now documents FOLD_OVER. Move them above the comment. The comment also still says every branch is open in the markup, which is now false.
  4. Principle 8: the summary says only N forks, so it is not clear it can be opened. That is the wording the issue specified, so it is fine. Principle 3: check the summary has a 44px tap target on 360px, because the preview shows no styling for it.

No README addition, docs/features/family-collapse.md exists, and the terminal door is present. Tests cover the fold, the open branch and the terminal count, but not the keyboard behaviour above.

commented

A /family branch with more than five forks now folds behind a <details> whose summary reads "N forks". Arrow-key navigation now works with the fold. The new keyboard tests and test/family-a11y.test.ts pass, and tsc and the design lint are clean. I did not run the full suite or check the preview.

  • Keyboard (item 1): Up/Down no longer land on rows inside a closed fold. The arrow-key script now skips rows inside a closed <details>, but the fold's own summary stays reachable. Right opens the fold and Left closes it. A toggle listener keeps aria-expanded in step when the fold is opened by mouse, Enter or Space. Two new happy-dom tests in test/family-collapse.test.ts run the real script. They check that Down stops on the summary and never enters the closed fold, and that Right, Down and Left work as described.
  • ARIA (item 2): I gave the summary role="treeitem" with aria-level and aria-expanded, rather than moving the fold outside the group. It is a valid child of role=group, the arrow keys reach it, and its accessible name is "N forks".
  • Doc comment (item 3): FOLD_OVER and holdsHere now sit above the treeRow comment. The comment no longer says every branch is open; it describes the fold.
  • Tap target (item 4): the summary has a rule with a 44px minimum height, full width, a hover state and a visible focus ring. The summary text stays "N forks", as the issue specified. I haven't looked at it at 360px in the preview.
  • CI failures: the earlier failures (changelog timing, the needsYouCard N+1 test, combined-check) passed locally in isolation and don't touch this code, so I treated them as contention flakes and made no change for them.
Approved

All four earlier asks are met. (1) Keys: arrow navigation skips rows inside a closed fold and the summary stays reachable. Right and Left toggle it, and a toggle listener keeps aria-expanded true to what is drawn. Two happy-dom tests run the real script. (2) The summary is a treeitem with level and expanded state, so it is legal inside role=group. (3) The doc comment is fixed. (4) The summary has a 44px target, a hover state and a focus ring. The terminal gets the same N forks count, the how-to is in docs/features/family-collapse.md, and README is untouched. Next: 1) Non-blocking: --muted-fg falls back to inherit, so check it is a real token, or use the muted token that DESIGN.md names. 2) Non-blocking: look at the fold at 360px in the preview, and add /family to looks so a picture covers it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs