Merge pull request #4524 from sbwalker/dev

prevent scroll position from resetting to top of page when querystring or hash changes
This commit is contained in:
Shaun Walker 2024-08-16 15:01:43 -04:00 committed by GitHub
commit 175cb9588c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -519,9 +519,9 @@
"<script>" + Environment.NewLine +
" // Blazor Static Rendering Scroll Position" + Environment.NewLine +
" window.interceptNavigation = () => {" + Environment.NewLine +
" let currentUrl = window.location.href;" + Environment.NewLine +
" let currentUrl = window.location.pathname;" + Environment.NewLine +
" Blazor.addEventListener('enhancedload', () => {" + Environment.NewLine +
" let newUrl = window.location.href;" + Environment.NewLine +
" let newUrl = window.location.pathname;" + Environment.NewLine +
" if (currentUrl != newUrl) {" + Environment.NewLine +
" window.scrollTo({ top: 0, left: 0, behavior: 'instant' });" + Environment.NewLine +
" }" + Environment.NewLine +