Skip to content

[Bug]: ScrollRestoration does not go to page top when redirecting in an action #9577

@john-evan08

Description

@john-evan08

What version of React Router are you using?

6.4.3

Steps to Reproduce

<Route 
     path="/"
     element={
	<div>
		<ScrollRestoration />
		<Outlet />
	</div>
	}
>
            <Route
	            path="post_route"
	            action={async ({ params }) => {
                           await patchServer()
	                  return redirect(`redirect_route`)
                     }}
            />

</Route>

The action is called with a <Form method="patch"/>

Expected Behavior

The action is called and redirect to the url redirect_route, but without scrolling to the top... I expected the page to scroll to the top when calling the action (and returning the redirect)

Actual Behavior

The action is called and the page redirects to the new route, but without scrolling to the top (it stays at the same place)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions