Skip to content

Commit

Permalink
Merge pull request #4524 from sbwalker/dev
Browse files Browse the repository at this point in the history
prevent scroll position from resetting to top of page when querystring or hash changes
  • Loading branch information
sbwalker authored Aug 16, 2024
2 parents b663528 + a8976e7 commit 175cb95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Oqtane.Server/Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down

0 comments on commit 175cb95

Please sign in to comment.