react-router icon indicating copy to clipboard operation
react-router copied to clipboard

`useElementScrollRestoration`

Open david-crespo opened this issue 3 years ago • 1 comments

First pass based on https://github.com/remix-run/react-router/discussions/9495. @ryanflorence will have feedback and I'm sure it'll change.

useScrollRestoration (and <ScrollRestoration />, which relies on it) only allows scroll restoration at the window level. This does not work if the scrolling container is something other than the full page, e.g., a 2x2 grid layout where the bottom right cell is the scrolling content pane. This change preserves the current API and behavior of useScrollRestoration while adding a new hook useElementScrollRestoration, which allows the caller to specify the ID of the scrolling container to use instead of window.

david-crespo avatar Nov 08 '22 19:11 david-crespo

⚠️ No Changeset found

Latest commit: aa03990eacab1f8902f525f927e91f0a15ef1a89

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Nov 08 '22 19:11 changeset-bot[bot]

@david-crespo Thank you for putting this together! I've been trying to do some housekeeping on the repo to start off 2023 and now that we've finished the "6.4 into Remix" work and things have settled down a bit. I'm going to close this PR until the linked discussion comes around and we can re-open when needed.

brophdawg11 avatar Jan 19 '23 19:01 brophdawg11