diff --git a/frontend/src/components/layout/statusbar.rs b/frontend/src/components/layout/statusbar.rs
index ff68c01..557c422 100644
--- a/frontend/src/components/layout/statusbar.rs
+++ b/frontend/src/components/layout/statusbar.rs
@@ -85,6 +85,17 @@ pub fn StatusBar() -> impl IntoView {
set_up_menu_open.set(false);
};
+ // Register global click/touch listener to close menus when clicking outside
+ let close_menus = move |_| {
+ if down_menu_open.get_untracked() { set_down_menu_open.set(false); }
+ if up_menu_open.get_untracked() { set_up_menu_open.set(false); }
+ if theme_open.get_untracked() { set_theme_open.set(false); }
+ };
+
+ // Use window_event_listener from leptos for both click and touchstart (for iOS)
+ let _ = window_event_listener(ev::click, close_menus);
+ let _ = window_event_listener(ev::touchstart, close_menus);
+
view! {
@@ -96,7 +107,7 @@ pub fn StatusBar() -> impl IntoView {
impl IntoView {
set_up_menu_open.set(false);
set_theme_open.set(false);
}
+ on:touchstart=move |e| {
+ e.stop_propagation();
+ // touchstart will trigger click usually, but we stop propagation here so window listener doesn't fire.
+ // We rely on click for the toggle logic to avoid double toggle.
+ }
>
@@ -116,19 +132,11 @@ pub fn StatusBar() -> impl IntoView {
-
-
-
-
{
limits.clone().into_iter().map(|(val, label)| {
@@ -165,7 +173,7 @@ pub fn StatusBar() -> impl IntoView {
impl IntoView {
set_down_menu_open.set(false);
set_theme_open.set(false);
}
+ on:touchstart=move |e| {
+ e.stop_propagation();
+ }
>
@@ -185,19 +196,11 @@ pub fn StatusBar() -> impl IntoView {
-
-
-
-
{
limits.clone().into_iter().map(|(val, label)| {
@@ -238,7 +241,7 @@ pub fn StatusBar() -> impl IntoView {
impl IntoView {
set_down_menu_open.set(false);
set_up_menu_open.set(false);
}
+ on:touchstart=move |e| {
+ e.stop_propagation();
+ }
>
-
-
-
-
{
let themes = vec![
@@ -290,7 +288,7 @@ pub fn StatusBar() -> impl IntoView {
-