From 1469d94683b6f2ef54d7a98dff8e14be1d244061 Mon Sep 17 00:00:00 2001 From: Daeksell Date: Mon, 22 Dec 2025 02:50:54 +0300 Subject: [PATCH] Fix dock panel button tooltip not dismissed when state changes via keyboard shortcut (#44746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #44720 Release Notes: - Fixed dock panel button tooltips not being dismissed when toggling panels via keyboard shortcut **Problem:** When hovering over a dock panel button and using a keyboard shortcut to toggle the panel, the tooltip remains visible with stale content. This is inconsistent with mouse click behavior, where the tooltip is dismissed on mouse down. **Solution:** Include the panel's active state in the button's element ID. When the state changes, the element ID changes (e.g., `"DebugPanel"` → `"DebugPanel-active"`), which causes GPUI to discard the old element state including the cached tooltip. **Testing:** Manually verified: 1. Hover over a dock panel button, wait for tooltip 2. Press keyboard shortcut to toggle the panel 3. Tooltip is now dismissed (consistent with mouse click behavior) https://github.com/user-attachments/assets/ed92fb6c-6c22-44e2-87e3-5461d35f7106 --------- Co-authored-by: MrSubidubi --- crates/workspace/src/dock.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index 7f4b09df0f94fa421c399ed9d70163f7cc2ba203..310ef8133e4a4bac1df42becec2b3d6574279431 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -1037,7 +1037,9 @@ impl Render for PanelButtons { .anchor(menu_anchor) .attach(menu_attach) .trigger(move |is_active, _window, _cx| { - IconButton::new(name, icon) + // Include active state in element ID to invalidate the cached + // tooltip when panel state changes (e.g., via keyboard shortcut) + IconButton::new((name, is_active_button as u64), icon) .icon_size(IconSize::Small) .toggle_state(is_active_button) .on_click({