Skip to content
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

[fix] scroll to elements provided via URL hash #2668

Merged
merged 9 commits into from
Oct 29, 2021
Merged

[fix] scroll to elements provided via URL hash #2668

merged 9 commits into from
Oct 29, 2021

Conversation

mikenikles
Copy link
Contributor

@mikenikles mikenikles commented Oct 22, 2021

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpx changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

Fixes #2664.

I also took the liberty to fix two test cases in packages/kit/test/apps/basics/src/routes/use-action/_tests.js as part of this PR.

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2021

🦋 Changeset detected

Latest commit: eec3dd7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@benmccann benmccann changed the title Scroll to elements provided via URL hash. [fix] scroll to elements provided via URL hash Oct 23, 2021
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for refining the anchor behaviour. I have a few comments below, but it would also be great to have a new test to check for manual user scrolling on mount.

packages/kit/src/runtime/client/renderer.js Outdated Show resolved Hide resolved
packages/kit/src/runtime/client/renderer.js Outdated Show resolved Hide resolved
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM. I'll wait a couple more days before merging so any maintainers can give another round of sanity check.

@bluwy bluwy requested a review from benmccann October 25, 2021 14:59
@benmccann
Copy link
Member

I'd like to know where this broke. Can you narrow down which release that happened at?

@mikenikles
Copy link
Contributor Author

I upgraded from 76 to 188, but there's someone who posted a more narrow version range at #2664 (comment).

Changes in that same area of the code were also made in #2489, but I don't know if that caused it.

@benmccann
Copy link
Member

Could you check the versions between those 10 to find out which one it is exactly? It would help to review this to know what happened

@bluwy
Copy link
Member

bluwy commented Oct 25, 2021

It's a 112 version difference so I'm not sure that's possible 😄 But I'm very certain #2489 introduced the regression, since initially we do the auto hash scrolling after the component mounted, but that PR moved it to before mounted in order to respect users manual scrolling.

But that inadvertently caused a bug with this specific use case because auto hash scrolling only works after mounted.

#2489 was released in 1.0.0-next.175

@benmccann
Copy link
Member

Just a 10 version range since the issue says:

the bug must have been introduced between and 1.0.0-next.169 and 1.0.0-next.179

The one you mentioned sounds pretty likely since it falls in that range

@mikenikles
Copy link
Contributor Author

✅ Confirmed, it works in 174 and is broken in 175.

bluwy and others added 2 commits October 29, 2021 14:00
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Ben McCann <[email protected]>
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.

Anchor links broken when navigating across pages
3 participants