WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@devel-maverick
Copy link

@devel-maverick devel-maverick commented Dec 2, 2025

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Documentation
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the dev branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #18185)
  • It's been tested on a Cordova (iOS, Android) app
  • It's been tested on an Electron app
  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

Description / What problem is solved:
QDialog does not restore scroll position if the URL hash or query parameters change while the dialog is open.
Currently, scroll is restored only if window.location.href === href, which fails when only hash/query changes.

This change updates the check to compare only the route path (window.location.pathname) instead of the full URL.
Scroll is now restored correctly after closing the dialog if the route path has not changed.

Code change:

// before:
if (window.location.href === href) {
  window.scrollTo(scrollPositionX, scrollPositionY)
}

// after:
if (window.location.pathname === new URL(href).pathname) {
  window.scrollTo(scrollPositionX, scrollPositionY)
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant