Skip to content

Conversation

@atscott
Copy link
Contributor

@atscott atscott commented Nov 5, 2025

This further builds out the Router integration with the platform
Navigation API. Key features in this state include:

  • History restoration via direct platform APIs rather than markers left on
    history.state. This means more guaranteed correctness and less
    internal code to compute traversal restorations.
  • Ability to observe navigations triggered outside the Router APIs.
    Practically speaking, this means some navigations can be performed
    through the platform rather than requiring Router.navigate. Note
    that because the NavigateEvent is never intercepted at this point of
    the implementation, regular anchor tags cannot be used because they
    will still trigger a popstate navigation.

This implementation does not intercept the NavigateEvent but future
iterations should. By omitting the interception, we are missing out on
features such as:

  • Platform-supported scroll and focus reset
  • Holding the navigate event open for the duration of the router
    navigation, allowing for a visual loading indicator in the browser
    (and ability to cancel navigation from the UI)
  • Support for intercepting navigations from regular anchor tags (e.g.
    not RouterLinks) and converting those to SPA navigations.

Reviewer note: As with prior changes to support the Navigation API, this affects neither the behavior nor the code size of any existing, non-tree shakeable default code paths.

As the integration with the browser navigation API is built out, we will want to have the types available
@atscott atscott added the target: rc This PR is targeted for the next release-candidate label Nov 5, 2025
@angular-robot angular-robot bot added area: build & ci Related the build and CI infrastructure of the project area: router labels Nov 5, 2025
@ngbot ngbot bot added this to the Backlog milestone Nov 5, 2025
@atscott atscott force-pushed the morenavigationcommits branch from 6808cb3 to 38bafb1 Compare November 5, 2025 19:44
@pullapprove pullapprove bot requested a review from josephperrott November 5, 2025 19:44
This further builds out the Router integration with the platform
Navigation API. Key features in this state include:

* History restoration via direct platform APIs rather than markers left on
  `history.state`. This means more guaranteed correctness and less
  internal code to compute traversal restorations.
* Ability to observe navigations triggered outside the Router APIs.
  Practically speaking, this means some navigations can be performed
  through the platform rather than requiring `Router.navigate`. Note
  that because the `NavigateEvent` is never intercepted at this point of
  the implementation, regular anchor tags cannot be used because they
  will still trigger a popstate navigation.

This implementation does _not_ intercept the `NavigateEvent` but future
iterations should. By omitting the interception, we are missing out on
features such as:

* Platform-supported scroll and focus reset
* Holding the navigate event open for the duration of the router
  navigation, allowing for a visual loading indicator in the browser
* Support for intercepting navigations from regular anchor tags (e.g.
  not `RouterLink`s) and converting those to SPA navigations.
@atscott atscott force-pushed the morenavigationcommits branch from 38bafb1 to 0b82847 Compare November 5, 2025 19:48
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +24 to +25
"tslib": "^2.3.0",
"@types/dom-navigation": "^1.0.5"
Copy link
Member

Choose a reason for hiding this comment

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

Since these types are not exported in the public API, and don't show up in the package anywhere as they are built-ins in the browser, you can depend on it under devDependencies

Suggested change
"tslib": "^2.3.0",
"@types/dom-navigation": "^1.0.5"
"tslib": "^2.3.0"
},
"devDependencies": {
"@types/dom-navigation": "^1.0.5"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build & ci Related the build and CI infrastructure of the project area: router target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants