From 7fd07dda55ee826205ac9c7d761702a4d8f49a9c Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Wed, 22 Apr 2026 12:53:30 -0400 Subject: [PATCH] git: Only show header staging checkboxes when hovering the header itself (#54204) Previously, we would show these checkboxes whenever hovering anywhere in the `entries` group, which covers all headers and status entries. This seems excessive, and also has a problem that the header checkboxes disappear when the mouse moves over a non-header (status entry) checkbox, presumably because those have `stop_propagation`. Now, we only show the checkbox for a header when that specific header is hovered. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --- crates/git_ui/src/git_panel.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 13e2d0970f1639086a1baa67fd1eb10890130bdb..1f9f08f47f09efaac8f35c2832f37002ec83185d 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -4961,6 +4961,7 @@ impl GitPanel { ) -> AnyElement { let id: ElementId = ElementId::Name(format!("header_{}", ix).into()); let checkbox_id: ElementId = ElementId::Name(format!("header_{}_checkbox", ix).into()); + let group_name: SharedString = format!("header_{}", ix).into(); let toggle_state = self.header_state(header.header); let section = header.header; let weak = cx.weak_entity(); @@ -4968,6 +4969,7 @@ impl GitPanel { h_flex() .id(id) + .group(group_name.clone()) .h(self.list_item_height()) .w_full() .items_center() @@ -5011,7 +5013,7 @@ impl GitPanel { }), ) .when(!show_checkbox_persistently, |this| { - this.visible_on_hover("entries") + this.visible_on_hover(group_name) }), ) .into_any_element()