-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scroll in enhanced navigation behaves same as in client side routing #60296
Conversation
…d scroll position.
… and enhanced nav handle the history produced by onDocumentClick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.
Files not reviewed (4)
- src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollPositionTests.razor: Evaluated as low risk
- src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollPositionTestsNoStreaming.razor: Evaluated as low risk
- src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollingToHash.razor: Evaluated as low risk
- src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollingToHashNoStreaming.razor: Evaluated as low risk
Comments suppressed due to low confidence (1)
src/Components/Web.JS/src/Services/NavigationEnhancement.ts:98
- The function saveScrollPosition should handle cases where the state is null or undefined. Add a check to ensure the state is correctly handled.
const currentState = history.state || {};
src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs
Outdated
Show resolved
Hide resolved
…ationTest.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Running the tests locally on repeat revealed an issue with browser's navigation. When we use programmatic navigation, it does not always load the new page (the history state changes but the DOM stays the same, we can see it as failure to render the element of List of affected test cases:
error:
|
The test cases that fall into this path:
are failing. This is not an issue connected with this PR and it happens on main as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Good job on the testing aspects of this feature, I know this is not a simple area and the coverage looks thorough!
…the history update.
Description
resetScrollAfterNextBatch()
in enhanced navNavigateTo
does not scroll to the top in internal navigation to same url #60190 for client side navigation.WaitForElementToBeVisible
extension was added. Without it, the tests withenableStreaming=true
would not be deterministic.Fixes #51646