From 8292ab440d87172c6663e2dffa1fad33d10ddb11 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Tue, 7 Apr 2026 09:26:09 -0300 Subject: [PATCH] collab_panel: Make channel items have a fixed height (#53304) Follow-up to https://github.com/zed-industries/zed/pull/53290 This PR fixes a mistake I pushed before of making the `ListItem`'s height method take pixels instead of a scalable unit like rems. Now, it takes `DefiniteLength` which can house both values, meaning we should be clear to set an explicit height for all of these items while still preserving font-size scaling. Release Notes: - N/A --- crates/collab_ui/src/collab_panel.rs | 7 +++++++ crates/ui/src/components/list/list_item.rs | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 1e1aab3b9d4aa0e48ad4a84ec77bdc6dff51c7f5..7dc807998760a8e65d373164eec5c7663171e5d0 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -1181,6 +1181,7 @@ impl CollabPanel { .into(); ListItem::new(project_id as usize) + .height(rems_from_px(24.)) .toggle_state(is_selected) .on_click(cx.listener(move |this, _, window, cx| { this.workspace @@ -1221,6 +1222,7 @@ impl CollabPanel { let id = peer_id.map_or(usize::MAX, |id| id.as_u64() as usize); ListItem::new(("screen", id)) + .height(rems_from_px(24.)) .toggle_state(is_selected) .start_slot( h_flex() @@ -1267,6 +1269,7 @@ impl CollabPanel { let has_channel_buffer_changed = channel_store.has_channel_buffer_changed(channel_id); ListItem::new("channel-notes") + .height(rems_from_px(24.)) .toggle_state(is_selected) .on_click(cx.listener(move |this, _, window, cx| { this.open_channel_notes(channel_id, window, cx); @@ -3207,9 +3210,12 @@ impl CollabPanel { (IconName::Star, Color::Default, "Add to Favorites") }; + let height = rems_from_px(24.); + h_flex() .id(ix) .group("") + .h(height) .w_full() .overflow_hidden() .when(!channel.is_root_channel(), |el| { @@ -3239,6 +3245,7 @@ impl CollabPanel { ) .child( ListItem::new(ix) + .height(height) // Add one level of depth for the disclosure arrow. .indent_level(depth + 1) .indent_step_size(px(20.)) diff --git a/crates/ui/src/components/list/list_item.rs b/crates/ui/src/components/list/list_item.rs index 9a764efd58cfd3365d92e534a715a0f23ce46e90..ece1fd3c61ec486c090808891a8eec662138b1b4 100644 --- a/crates/ui/src/components/list/list_item.rs +++ b/crates/ui/src/components/list/list_item.rs @@ -52,7 +52,7 @@ pub struct ListItem { overflow_x: bool, focused: Option, docked_right: bool, - height: Option, + height: Option, } impl ListItem { @@ -207,8 +207,8 @@ impl ListItem { self } - pub fn height(mut self, height: Pixels) -> Self { - self.height = Some(height); + pub fn height(mut self, height: impl Into) -> Self { + self.height = Some(height.into()); self } }