Skip to content

feat(table-of-contents): add new TEDI-Ready component #543 - #551

Open
ly-tempel-bitweb wants to merge 5 commits into
rcfrom
feat/543-add-table-of-contents-tedi-ready-component
Open

feat(table-of-contents): add new TEDI-Ready component #543#551
ly-tempel-bitweb wants to merge 5 commits into
rcfrom
feat/543-add-table-of-contents-tedi-ready-component

Conversation

@ly-tempel-bitweb

@ly-tempel-bitweb ly-tempel-bitweb commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

https://storybook.tedi.ee/angular/feat/543-add-table-of-contents-tedi-ready-component/?path=/docs/tedi-ready-components-navigation-tableofcontents--docs

Summary by CodeRabbit

  • New Features

    • Added desktop and mobile table-of-contents components with nested items, active-state highlighting, numbering, sticky positioning, customizable headings, and accessible navigation labels.
    • Added a collapsible mobile table of contents with bottom-sheet behavior and keyboard-accessible controls.
  • Documentation

    • Added usage guidance and configuration details for the new components.
  • Deprecation

    • Marked the previous table-of-contents components as deprecated and directed users to the new components.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ly-tempel-bitweb, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6980a8a1-755c-4ee4-8751-553956af441c

📥 Commits

Reviewing files that changed from the base of the PR and between f917079 and ae229f7.

📒 Files selected for processing (1)
  • skills/tedi-angular/references/components.md
📝 Walkthrough

Walkthrough

Adds standalone desktop and collapsible Table of Contents components with nested items, active-branch expansion, numbering, accessibility behavior, styling, tests, Storybook examples, public exports, documentation, and community deprecation metadata.

Changes

Table of Contents components

Layer / File(s) Summary
Core rendering and item hierarchy
tedi/components/navigation/table-of-contents/...
Adds configurable rendering, nested item projection, active-branch expansion, numbering, accessibility state, visual variants, sticky behavior, styling, and unit tests.
Collapsible sheet interaction
tedi/components/navigation/table-of-contents/table-of-contents-collapsible/...
Adds a mobile bottom bar and dialog sheet with projected items, close handling, accessibility labels, and lifecycle tests.
Public integration and examples
tedi/components/navigation/index.ts, tedi/components/navigation/table-of-contents/index.ts, tedi/components/navigation/table-of-contents/table-of-contents.stories.ts, skills/tedi-angular/references/components.md
Exports the components and documents and demonstrates desktop, nested, numbered, sticky, item-state, and collapsible configurations.
Community migration metadata
community/components/navigation/table-of-contents/...
Marks existing community Table of Contents components as deprecated and adds Storybook status metadata.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HostComponent
  participant TableOfContentsCollapsibleComponent
  participant Overlay
  participant Dialog
  HostComponent->>TableOfContentsCollapsibleComponent: Click bottom-bar toggle
  TableOfContentsCollapsibleComponent->>Overlay: Configure bottom position
  TableOfContentsCollapsibleComponent->>Dialog: Open sheet with projected items
  Dialog-->>TableOfContentsCollapsibleComponent: Emit close event
  TableOfContentsCollapsibleComponent->>TableOfContentsCollapsibleComponent: Clear open dialog reference
Loading

Possibly related PRs

Suggested reviewers: airikej, mart-sessman

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new TEDI-Ready Table of Contents component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/543-add-table-of-contents-tedi-ready-component

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (4)
tedi/components/navigation/table-of-contents/table-of-contents.component.ts (1)

94-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Apply the required component member ordering consistently.

  • tedi/components/navigation/table-of-contents/table-of-contents.component.ts#L94-L94: move translations before the public inputs.
  • tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.ts#L56-L61: move all injected dependencies before the public inputs.

As per path instructions, injected services must precede inputs/signals.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tedi/components/navigation/table-of-contents/table-of-contents.component.ts`
at line 94, Reorder component members so injected dependencies precede public
inputs and signals: move the translations injection in
tedi/components/navigation/table-of-contents/table-of-contents.component.ts
(lines 94-94) before the public inputs, and move all injected dependencies in
tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.ts
(lines 56-61) before its public inputs, without changing behavior.

Source: Path instructions

tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts (2)

78-80: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Move injected services to the top of the class.

As per path instructions, component architecture must follow the order: injected services → inputs/signals → outputs → internal signals/computed → lifecycle → public/private methods. Please move these injected services above the input() declarations.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts`
around lines 78 - 80, Reorder the class members in the table-of-contents
collapsible component so the injected services (`dialog`, `overlay`, and
`translations`) appear before all `input()` declarations, followed by the
remaining members in the prescribed architecture order.

Source: Path instructions


93-97: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify redundant nullish coalescing logic.

The resolved ?? this.titleLabel() operation treats an explicit null as a fallback trigger. Since both undefined and null will fall back to this.titleLabel(), the explicit undefined check is redundant and can be simplified.

♻️ Proposed refactor
   readonly title = computed(() => {
-    const heading = this.heading();
-    const resolved = heading === undefined ? this.titleLabel() : heading;
-    return resolved ?? this.titleLabel();
+    return this.heading() ?? this.titleLabel();
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts`
around lines 93 - 97, The title computed value redundantly checks for undefined
and then applies nullish fallback. Simplify the logic in the title computed
property so both null and undefined heading values fall back directly to
this.titleLabel(), while preserving non-null heading values unchanged.
tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.spec.ts (1)

36-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Mock TediTranslationService and the CDK dialog/overlay. The spec should use a local translation stub instead of the real service, and a dialog/overlay test double instead of opening the sheet into document.body.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.spec.ts`
around lines 36 - 40, Update the table-of-contents-collapsible test setup in
beforeEach to provide a local TediTranslationService mock and CDK dialog/overlay
test doubles. Replace the real service and document.body-backed sheet behavior
while preserving the existing HostComponent test flow and translation token
configuration.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts`:
- Line 51: Update TableOfContentsCollapsibleComponent to implement Angular’s
OnDestroy lifecycle interface, import it from `@angular/core`, and add
ngOnDestroy() that calls the existing close() method so any open dialog is
closed when the component is destroyed.

In
`@tedi/components/navigation/table-of-contents/table-of-contents.component.scss`:
- Around line 104-113: Update the selected-state rule under
.tedi-table-of-contents__item--selected > .tedi-table-of-contents__row to
include the established projected-icon inherited-color selector, ensuring
projected icons within selected links or buttons inherit
var(--link-primary-active) alongside the text color.

In
`@tedi/components/navigation/table-of-contents/table-of-contents.component.spec.ts`:
- Around line 75-79: Update the test setup in setup to provide a deterministic
mock TediTranslationService with track() and translate() methods, alongside the
existing TEDI_TRANSLATION_DEFAULT_TOKEN provider. Ensure translated component
tests use the mock service instead of the real implementation.

In `@tedi/components/navigation/table-of-contents/table-of-contents.stories.ts`:
- Around line 213-242: Update the scroll-spy implementation around the
IntersectionObserver and scroll handler at
tedi/components/navigation/table-of-contents/table-of-contents.stories.ts:213-242
to retain the listener reference and release all resources during destruction:
disconnect the observer, remove the stored scroll listener, and clear
seekEndTimeout. Apply the corresponding observer-destruction cleanup to the
copy-pasteable source example at
tedi/components/navigation/table-of-contents/table-of-contents.stories.ts:823-837.

---

Nitpick comments:
In
`@tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.spec.ts`:
- Around line 36-40: Update the table-of-contents-collapsible test setup in
beforeEach to provide a local TediTranslationService mock and CDK dialog/overlay
test doubles. Replace the real service and document.body-backed sheet behavior
while preserving the existing HostComponent test flow and translation token
configuration.

In
`@tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts`:
- Around line 78-80: Reorder the class members in the table-of-contents
collapsible component so the injected services (`dialog`, `overlay`, and
`translations`) appear before all `input()` declarations, followed by the
remaining members in the prescribed architecture order.
- Around line 93-97: The title computed value redundantly checks for undefined
and then applies nullish fallback. Simplify the logic in the title computed
property so both null and undefined heading values fall back directly to
this.titleLabel(), while preserving non-null heading values unchanged.

In `@tedi/components/navigation/table-of-contents/table-of-contents.component.ts`:
- Line 94: Reorder component members so injected dependencies precede public
inputs and signals: move the translations injection in
tedi/components/navigation/table-of-contents/table-of-contents.component.ts
(lines 94-94) before the public inputs, and move all injected dependencies in
tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.ts
(lines 56-61) before its public inputs, without changing behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d3ada7f0-21e3-457d-8d60-66df663bcee6

📥 Commits

Reviewing files that changed from the base of the PR and between df541ec and 52a8b03.

📒 Files selected for processing (18)
  • community/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.ts
  • community/components/navigation/table-of-contents/table-of-contents-nested-wrapper.component.ts
  • community/components/navigation/table-of-contents/table-of-contents.component.ts
  • community/components/navigation/table-of-contents/table-of-contents.stories.ts
  • skills/tedi-angular/references/components.md
  • tedi/components/navigation/index.ts
  • tedi/components/navigation/table-of-contents/index.ts
  • tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.html
  • tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.spec.ts
  • tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts
  • tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.html
  • tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.ts
  • tedi/components/navigation/table-of-contents/table-of-contents.component.html
  • tedi/components/navigation/table-of-contents/table-of-contents.component.scss
  • tedi/components/navigation/table-of-contents/table-of-contents.component.spec.ts
  • tedi/components/navigation/table-of-contents/table-of-contents.component.ts
  • tedi/components/navigation/table-of-contents/table-of-contents.stories.ts
  • tedi/services/translation/translations.ts

Comment on lines +104 to +113
.tedi-table-of-contents__item--selected > .tedi-table-of-contents__row {
border-left-color: var(--general-border-brand);

.tedi-table-of-contents__number {
color: var(--link-primary-active);
}

.tedi-table-of-contents__content :is(a, button) {
color: var(--link-primary-active);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep projected icons synchronized with the selected text color.

The selected state changes the link/button color but provides no matching override for projected icons, so a link icon can retain its default color. Add the established inherited-color rule for projected icons in this state.

As per coding guidelines, projected icons must inherit parent hover or selected/active colors.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tedi/components/navigation/table-of-contents/table-of-contents.component.scss`
around lines 104 - 113, Update the selected-state rule under
.tedi-table-of-contents__item--selected > .tedi-table-of-contents__row to
include the established projected-icon inherited-color selector, ensuring
projected icons within selected links or buttons inherit
var(--link-primary-active) alongside the text color.

Sources: Coding guidelines, Path instructions

Comment on lines +75 to +79
const setup = async (component: unknown) => {
await TestBed.configureTestingModule({
imports: [component as never],
providers: [{ provide: TEDI_TRANSLATION_DEFAULT_TOKEN, useValue: "en" }],
}).compileComponents();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Mock TediTranslationService in translated component tests.

Provide a deterministic mock for the track() and translate() calls alongside TEDI_TRANSLATION_DEFAULT_TOKEN, rather than exercising the real service.

As per coding guidelines, translated component tests must mock TediTranslationService and provide TEDI_TRANSLATION_DEFAULT_TOKEN.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tedi/components/navigation/table-of-contents/table-of-contents.component.spec.ts`
around lines 75 - 79, Update the test setup in setup to provide a deterministic
mock TediTranslationService with track() and translate() methods, alongside the
existing TEDI_TRANSLATION_DEFAULT_TOKEN provider. Ensure translated component
tests use the mock service instead of the real implementation.

Sources: Coding guidelines, Path instructions

Comment thread tedi/components/navigation/table-of-contents/table-of-contents.stories.ts Outdated
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ly-tempel-bitweb ly-tempel-bitweb linked an issue Aug 5, 2026 that may be closed by this pull request
21 tasks
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

♿ Accessibility — ✅ no blocking violations

No accessibility violations in the components changed by this PR.

⚠️ Pre-existing — 3 violations in components not changed here (warn only)

Component Rules Stories
TEDI-Ready/Components/Form/InputGroup aria-input-field-name ×3 3
Stories

🔕 Known issues — 18 stories marked todo (warn only)

Stories

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
skills/tedi-angular/references/components.md (1)

1819-1819: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the itemId parentage description.

itemId is used for active-state matching. Nested items are linked through projected child content (contentChildren(TableOfContentsItemComponent)), not through itemId. Remove the parentage claim, or make parent IDs a required API requirement if they are intentional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/tedi-angular/references/components.md` at line 1819, Update the itemId
description in the component documentation to state only its active-state
matching role via the parent’s activeId; remove the claim that itemId parents
nested items, since nesting is established through projected
TableOfContentsItemComponent children.
🧹 Nitpick comments (1)
tedi/components/navigation/table-of-contents/table-of-contents.stories.ts (1)

44-156: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Apply the TEDI component convention to this story demo.

Set changeDetection: ChangeDetectionStrategy.OnPush and encapsulation: ViewEncapsulation.None. Rename the toc-sticky-demo selector and BEM block to use the tedi- prefix. Update the template reference at Line 834 when the selector changes.

As per coding guidelines, “All TEDI Angular components must be standalone, use OnPush change detection, use ViewEncapsulation.None, use Angular signals ..., and use the tedi- selector prefix.” As per path instructions, “Style with tedi-prefixed BEM classes.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tedi/components/navigation/table-of-contents/table-of-contents.stories.ts`
around lines 44 - 156, Update TocStickyDemoComponent to use
ChangeDetectionStrategy.OnPush and ViewEncapsulation.None, adding the required
Angular imports. Rename the toc-sticky-demo selector and all related BEM classes
to use the tedi- prefix, including their styles and every template reference to
the component selector.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@skills/tedi-angular/references/components.md`:
- Line 1819: Update the itemId description in the component documentation to
state only its active-state matching role via the parent’s activeId; remove the
claim that itemId parents nested items, since nesting is established through
projected TableOfContentsItemComponent children.

---

Nitpick comments:
In `@tedi/components/navigation/table-of-contents/table-of-contents.stories.ts`:
- Around line 44-156: Update TocStickyDemoComponent to use
ChangeDetectionStrategy.OnPush and ViewEncapsulation.None, adding the required
Angular imports. Rename the toc-sticky-demo selector and all related BEM classes
to use the tedi- prefix, including their styles and every template reference to
the component selector.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 21034fee-fe75-4d3c-b6a3-e7537fa5cfc6

📥 Commits

Reviewing files that changed from the base of the PR and between 52a8b03 and f917079.

📒 Files selected for processing (9)
  • skills/tedi-angular/references/components.md
  • tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts
  • tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.html
  • tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.ts
  • tedi/components/navigation/table-of-contents/table-of-contents.component.scss
  • tedi/components/navigation/table-of-contents/table-of-contents.component.spec.ts
  • tedi/components/navigation/table-of-contents/table-of-contents.component.ts
  • tedi/components/navigation/table-of-contents/table-of-contents.stories.ts
  • tedi/services/translation/translations.ts
💤 Files with no reviewable changes (4)
  • tedi/components/navigation/table-of-contents/table-of-contents-item/table-of-contents-item.component.html
  • tedi/components/navigation/table-of-contents/table-of-contents.component.scss
  • tedi/components/navigation/table-of-contents/table-of-contents.component.spec.ts
  • tedi/components/navigation/table-of-contents/table-of-contents.component.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tedi/components/navigation/table-of-contents/table-of-contents-collapsible/table-of-contents-collapsible.component.ts

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.

[TableOfContents]: new TEDI-Ready component

1 participant