web: scroll to top when viewing a new tag

This commit is contained in:
Bill Thiede 2024-08-06 20:54:25 -07:00
parent e570202ba2
commit e81a452dfb

View File

@ -1008,7 +1008,12 @@ pub fn view_tags(model: &Model) -> Node<Msg> {
}, },
], ],
display_name, 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 { fn matches(a: &[&str], b: &[&str]) -> usize {