Skip to content

fix(tree): errors following a full review of the component - #1946

Draft
lskramarov wants to merge 8 commits into
mainfrom
review/tree
Draft

fix(tree): errors following a full review of the component#1946
lskramarov wants to merge 8 commits into
mainfrom
review/tree

Conversation

@lskramarov

Copy link
Copy Markdown
Contributor

Summary

The tree is a hard fork of @angular/cdk/tree that re-implements the whole CDK tree concept set, and
it carries the debt of an old fork: a fragile global static node handoff, an 811-line god component,
pervasive any, and a half-finished signals migration. The review closed the accessibility gap,
finished the migration behind an ng update schematic, and added the unit coverage several of its
sub-modules never had.

The second commit fixes a deprecated binding in the docs and a stale invariant comment.

List of notable changes:

  • added the ARIA layer the tree substrate was missing, including the trailing option-action button,
    which gains a locale-backed accessible name (optionActions in KbqA11yLocaleConfiguration)
  • fixed the blur handling in tree-selection.component.ts, so the tree only blurs when the option
    that lost focus is the one the key manager considers active
  • updated the half-finished signals/standalone migration and shipped the tree-signals schematic
    for the renamed surface
  • added unit specs for four sub-modules that had none: flat-tree-control.filters,
    flat-data-source, padding.directive and toggle
  • updated the public API: KBQ_SELECTION_TREE_VALUE_ACCESSOR, KBQ_TREE_OPTION_PARENT_COMPONENT,
    getParents, nodeDefs, the dataSource/indent/recursive accessor pairs and indentUnits all
    changed shape or left the report
  • updated the docs example off the deprecated (onSelectAll) output, which this same branch marks
    @deprecated … will be removed in version 20 in favour of selectAllChange
  • fixed a stale comment in the select-all template: it claimed one @let read covers all four
    reads of selectAllState, which stopped being true when this branch removed two of them; the row's
    own aria-checked host binding is a third, independent read

What should reviewers focus on?

  • packages/schematics/src/migrations/tree-signals/ and its registration.
  • packages/components/core/option/action.ts and core/utils/dom.ts are shared; select and
    tree-select also touch this area in this series.
  • packages/components/tree-select/tree-select.component.ts is modified here as a consumer of the
    changed tree contract, and the tree-select branch modifies the same file.
  • The comment fix is deliberately comment-only: removing the second selectAllTargets walk would need
    a new public input on KbqTreeOption, and the extra walk produces no wrong output.

One of ten pull requests from a single review pass (review/*). Every branch carries two commits: the
fixes from the component review, and a second pass over the findings an independent verifier could not
confirm outright.

The branches share files, so they have to be merged one at a time with a rebase in between. Overlap:
packages/components/core/locales/* (7 branches), tools/public_api_guard/components/core.api.md (7),
tools/cspell-locales/*.json (6), packages/e2e/routes.ts (4) and
packages/schematics/src/{collection,migrations}.json (3).

@github-actions

Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@github-actions github-actions Bot added the bug Something isn't working label Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 3f94c35):

https://koobiq-next--prs-1946-tmsv6fhb.web.app

(expires Fri, 04 Sep 2026 16:15:38 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c

@github-actions

Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@lskramarov lskramarov self-assigned this Aug 27, 2026
Defining --kbq-tree-size-toggle-padding turned on two padding declarations that had
never resolved, widening .kbq-tree-node-toggle from 16px to 24px. The 24px that
KbqTreeNodePadding.iconWidth reserves for a node without a toggle stands in for the
16px toggle plus the option's 8px gap, so every row with a chevron ended up 8px to
the right of its leaf siblings. The contract is now written down next to iconWidth.

Pointing .kbq-option-text at --kbq-tree-size-text-padding-vertical fixed the
reference but changed the value from 0 to 2px, growing every two-line row by 4px and
dropping its text below the chevron and checkbox beside it, whose margins are tuned
to a text box with no padding of its own.
Documenting KbqTreeNodePadding.iconWidth drops its `// (undocumented)` marker from the
report. Content taken verbatim from the diff API Extractor printed on CI.
The tree-signals schematic shipped without a section in the upgrade guide, and this is
the one review whose unmigrated call sites throw rather than fail to compile: assigning
to a getter-only property is a TypeError in any strict-mode build.
`feat(list,tree,core)!: allow changing multiple after initialization` builds the model as
`SelectionModel<SelectionModelOption>` and swaps the instance when the multiplicity changes,
so the review's widening back to `any` is dropped along with its argument that no call site
produces that shape — and the `any` ratchet prefers the typed one either way.
The snapshot came from upstream while the rebase ran, so it carried none of the review's
narrowings. Regenerated from a fresh build rather than edited by hand.
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

Two consequences of following main's `SelectionModel<SelectionModelOption>` instead of the
review's widening. The spec reads a selected node back as the consumer's own type, which the
declared shape does not describe, so the call site casts and says why. And the `any` ratchet
had to record the improvement it produced: tree drops from 41 to 40.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant