From fd65dc5d531aa4cd9ec8dcb44cfb228ec593262a Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Sun, 9 Nov 2025 11:24:31 -0800 Subject: [PATCH] refactor(router): add comment about scroll/focus Add consideration for future behavior in the completion of the navigation event. --- packages/router/src/statemanager/navigation_state_manager.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/router/src/statemanager/navigation_state_manager.ts b/packages/router/src/statemanager/navigation_state_manager.ts index 316861ad030..ce4c5284618 100644 --- a/packages/router/src/statemanager/navigation_state_manager.ts +++ b/packages/router/src/statemanager/navigation_state_manager.ts @@ -169,6 +169,10 @@ export class NavigationStateManager extends StateManager { removeAbortListener?.(); // Update `activeHistoryEntry` to the new current entry from Navigation API. this.activeHistoryEntry = this.navigation.currentEntry!; + // TODO(atscott): Consider initiating scroll here since it will be attempted periodically. + // We have to wait for render to resolve because focus reset is only done once in the spec. + // Render is not synchronous with NavigationEnd today. The Router's navigation promise resolve + // is what _causes_ the render to happen with ZoneJS... // Resolve handler after next render to defer scroll and focus reset. afterNextRender({read: () => resolveHandler?.()}, {injector: this.injector}); }