Skip to content

docs: add router events flowchart to lifecycle guide - #72291

Closed
sefatanam wants to merge 1 commit into
angular:mainfrom
sefatanam:docs/router-events-diagram
Closed

sefatanam wants to merge 1 commit into
angular:mainfrom
sefatanam:docs/router-events-diagram

Conversation

@sefatanam

Copy link
Copy Markdown

Add a Mermaid flowchart to the "Common router events" section that shows the order of the router events and where a navigation can end early (NavigationSkipped, NavigationCancel, NavigationError).

Add opt-in, theme-aware flowchart styles that follow the existing Gantt chart look (tinted fills, accent borders, rounded corners, no shadow), using only existing color variables, and give edge labels the page background so they read well in both light and dark mode.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

The "Common router events" section of the Router Lifecycle and Events guide lists the events in two tables, but there is no visual showing their order or where a navigation can end early.

Issue Number: Part of #72252

What is the new behavior?

Adds a Mermaid flowchart under the event tables that shows:

  • the successful path, NavigationStart → RoutesRecognized → GuardsCheckStart → GuardsCheckEnd → ResolveStart → ResolveEnd → NavigationEnd
  • NavigationSkipped as a separate path that happens instead of NavigationStart (same URL, ignored)
  • NavigationCancel and NavigationError leaving the in-progress steps, since both can happen at any step

A short paragraph below the diagram explains what causes a cancel (a guard returns false, a guard or resolver redirects, or a newer navigation starts) and what causes an error.

The diagram uses new opt-in classes in _mermaid.scss that follow the existing Gantt chart look: a tinted fill, an accent border, rounded corners and no shadow. They use only existing color variables, so they adapt to light and dark mode.

Light Dark
Router_lifecycle_light_mode Router_lifecycle_dark_mode

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

  • All new node styles are opt-in through classes (stepNode, entryNode, successNode, warningNode, errorNode, mutedNode, and groupBox for subgraphs), so existing diagrams are unchanged.
  • One exception: the edge label style applies to all flowcharts. Arrow labels in the Forms overview guide now use the page background instead of the default lavender boxes, which looked out of place in dark mode.
  • Contrast was measured in both themes: label text is at least 11.9:1 and node borders are at least 4.3:1 (WCAG asks for 4.5:1 and 3:1).

Add a Mermaid flowchart to the "Common router events" section that shows
the order of the router events and where a navigation can end early
(NavigationSkipped, NavigationCancel, NavigationError).

Add opt-in, theme-aware flowchart styles that follow the existing Gantt
chart look (tinted fills, accent borders, rounded corners, no shadow),
using only existing color variables, and give edge labels the page
background so they read well in both light and dark mode.
@google-cla

google-cla Bot commented Dec 2, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@angular-robot angular-robot Bot added the area: docs Related to the documentation label Dec 2, 2026
@ngbot ngbot Bot added this to the Backlog milestone Dec 2, 2026
@pullapprove
pullapprove Bot requested a review from bencodezen December 2, 2026 12:06
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Deployed adev-preview for af17077 to: https://ng-dev-previews-fw--pr-angular-angular-72291-adev-prev-suc4j737.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

@JeanMeche

Copy link
Copy Markdown
Member

This is one of the cases where I think a chart brings little value. This is indeed shows event order for a top level navigation but doesn't represent real-life scenarios.

Thanks anyway.

@JeanMeche JeanMeche closed this Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adev: preview area: docs Related to the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants