web: try setting history.scroll_restoration to manual to impove inter-page flow

This commit is contained in:
Bill Thiede 2025-02-26 15:42:51 -08:00
parent f9eafff4c7
commit 3aa0144e8d
2 changed files with 8 additions and 0 deletions

View File

@ -50,4 +50,6 @@ features = [
"MediaQueryList",
"Navigator",
"Window",
"History",
"ScrollRestoration",
]

View File

@ -29,6 +29,12 @@ pub fn unread_query() -> &'static str {
pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
let version = letterbox_shared::build_version(bi);
info!("Build Info: {}", version);
// Disable restoring to scroll position when navigating
window()
.history()
.expect("couldn't get history")
.set_scroll_restoration(web_sys::ScrollRestoration::Manual)
.expect("failed to set scroll restoration to manual");
if url.hash().is_none() {
orders.request_url(urls::search(unread_query(), 0));
} else {