fix: routing logic to scroll to top was broken (#1335)

This commit is contained in:
Greg Johnston 2023-07-13 06:43:49 -04:00 committed by GitHub
parent e9665b34e5
commit 8a90f97959
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
}
}