From e81a452dfb5e597f26ea4ad5480cb82951bb4c5f Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Tue, 6 Aug 2024 20:54:25 -0700 Subject: [PATCH] web: scroll to top when viewing a new tag --- web/src/view/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/view/mod.rs b/web/src/view/mod.rs index b719372..c57b41a 100644 --- a/web/src/view/mod.rs +++ b/web/src/view/mod.rs @@ -1008,7 +1008,12 @@ pub fn view_tags(model: &Model) -> Node { }, ], display_name, - IF!(t.unread>0 => format!(" ({})", t.unread)) + IF!(t.unread>0 => format!(" ({})", t.unread)), + ev(Ev::Click, |_| { + // Scroll window to the top when searching for a tag. + info!("scrolling to the top because you clicked a tag"); + web_sys::window().unwrap().scroll_to_with_x_and_y(0., 0.); + }) ]] } fn matches(a: &[&str], b: &[&str]) -> usize {