gui: improve channel selection behavior (#21)
Build Mumble Web 2 / windows_build (push) Successful in 2m41s
Build Mumble Web 2 / linux_build (push) Successful in 1m25s
Build Mumble Web 2 / android_build (push) Successful in 5m58s
Build android container / android-release-builder-container-build (push) Successful in 9s
Build Mumble Web 2 release builder containers / windows-release-builder-container-build (push) Successful in 13s

# Summary
This change improves the channel selection behavior to be more similar to the official client and generally more usable. It's currently mildly broken due to the details element grabbing click events from the whole row and the row text being selectable. This change also makes it more obvious that the channel title can be clicked. I'm not sure how this works on mobile, so we might need to make more changes there in the future to work better with touchscreens.

# Changes
- Channels can only be expanded or collapsed by clicking on the adjacent arrow
- Expand/collapse arrows are only displayed on channels with children or users
- Channel can only be joined by double clicking to the right of the collapse/expand arrow
- The channel title background (and the empty space to the right) display a highlight when the user hovers over them.
- All text inside the channel view is no longer selectable.

# Testing
I tested on the desktop client. I didn't test on mobile but I'll give it a shot after I merge and maybe come back with another PR to make this behavior more intuitive over there.

Reviewed-on: #21
This commit was merged in pull request #21.
This commit is contained in:
2026-01-28 06:03:23 +00:00
parent feaa9f2bda
commit 2fcb853c30
2 changed files with 78 additions and 9 deletions
+38
View File
@@ -83,6 +83,44 @@ a:visited {
} }
} }
.channel_header {
display: flex;
flex-direction: row;
align-items: center;
}
.channel_arrow {
width: 1em;
text-align: center;
margin-right: 0.25rem;
}
.channel_arrow--placeholder {
pointer-events: none;
visibility: hidden;
}
/* The whole right side of the row is the dblclick target */
.channel_row_click {
flex: 1;
padding: 0.1rem 0.25rem 0.1rem 0.5rem;
cursor: pointer;
}
/* Hover highlight for whole row area (title + blank space) */
.channel_row_click:hover {
background-color: var(--channel-hover-bg, #222); /* pick your color */
}
/* still keep text non-selectable if desired */
.channel_details {
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.channel { .channel {
&_details { &_details {
flex: 0 0 100%; flex: 0 0 100%;
+37 -6
View File
@@ -291,22 +291,53 @@ pub fn Channel(id: ChannelId) -> Element {
return rsx!("missing channel {id}"); return rsx!("missing channel {id}");
}; };
let mut open = use_signal(|| true);
let has_children = !state.users.is_empty() || !state.children.is_empty();
rsx!( rsx!(
details { div {
class: "channel_details", class: "channel_details",
open: true,
summary { div {
class: "channel_header",
// Arrow: only toggles open
if has_children {
span { span {
role: "button", class: "channel_arrow",
ondoubleclick: move |evt| { onclick: move |evt| {
evt.stop_propagation();
evt.prevent_default();
let mut w = open.write();
*w = !*w;
},
if *open.read() { "" } else { "" }
}
} else {
span {
class: "channel_arrow channel_arrow--placeholder",
" "
}
}
// Clickable row area (everything except the arrow)
div {
class: "channel_row_click",
ondblclick: move |evt| {
evt.stop_propagation(); evt.stop_propagation();
evt.prevent_default(); evt.prevent_default();
net.send(EnterChannel { channel: id, user }) net.send(EnterChannel { channel: id, user })
}, },
// remove dblclick from the inner span
span {
class: "channel_title",
"{state.name}" "{state.name}"
} }
// if you add icons/badges later, put them here too
} }
if state.users.len() + state.children.len() > 0 { }
if *open.read() && has_children {
div { div {
class: "channel_children", class: "channel_children",
for id in state.users.iter() { for id in state.users.iter() {