mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
fix: routing logic to scroll to top was broken (#1335)
This commit is contained in:
parent
e9665b34e5
commit
8a90f97959
1 changed files with 7 additions and 3 deletions
|
@ -126,12 +126,16 @@ impl History for BrowserIntegration {
|
|||
.unwrap_or(hash);
|
||||
let el = leptos_dom::document().get_element_by_id(&hash);
|
||||
if let Some(el) = el {
|
||||
el.scroll_into_view()
|
||||
} else if loc.scroll {
|
||||
leptos_dom::window().scroll_to_with_x_and_y(0.0, 0.0);
|
||||
el.scroll_into_view();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// scroll to top
|
||||
if loc.scroll {
|
||||
leptos_dom::window().scroll_to_with_x_and_y(0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue