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

Scroll back to top of page automatically on navigation #121

Closed
Tracked by #120
lukechu10 opened this issue Jun 25, 2021 · 2 comments · Fixed by #186
Closed
Tracked by #120

Scroll back to top of page automatically on navigation #121

lukechu10 opened this issue Jun 25, 2021 · 2 comments · Fixed by #186
Assignees
Labels
A-router Area: router D-easy Difficulty: easy good first issue Good for newcomers

Comments

@lukechu10
Copy link
Collaborator

lukechu10 commented Jun 25, 2021

Simply call window.scrollTo(0, 0) (equivalent using wasm-bindgen) after here:

// Update History API.
let history = web_sys::window().unwrap().history().unwrap();
history
.push_state_with_url(
&JsValue::UNDEFINED,
"",
Some(pathname.get().as_str()),
)
.unwrap();

and here:
// Update History API.
let history = web_sys::window().unwrap().history().unwrap();
history
.push_state_with_url(&JsValue::UNDEFINED, "", Some(pathname.get().as_str()))
.unwrap();

@lukechu10 lukechu10 mentioned this issue Jun 25, 2021
7 tasks
@lukechu10 lukechu10 added D-easy Difficulty: easy good first issue Good for newcomers A-router Area: router labels Jun 25, 2021
@Ochism
Copy link
Contributor

Ochism commented Jul 26, 2021

I would be willing to work on this

@lukechu10
Copy link
Collaborator Author

lukechu10 commented Jul 27, 2021

I would be willing to work on this

Awesome!

Edit: Note that the instructions are slightly out of date with some of the newer changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-router Area: router D-easy Difficulty: easy good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants