From 84ec12e4719043132d8dabaa203649c7f6014d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 10 May 2026 00:47:31 -0400 Subject: [PATCH] =?UTF-8?q?Make=20vertical=20tab=20close=20(=C3=97)=20butt?= =?UTF-8?q?ons=20reliably=20hittable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues kept the close button unusable: - The launcher-row close button lacked flex_shrink_0, so on narrow sidebars the title swallowed the 16 px hit target before flex laid it out. - The handler did select_tab(close_id) → close_active_tab(); if the newly-selected tab routed through split-view close logic the call silently no-op'd against the user's intent. Add flex_shrink_0 on both launcher and tab close buttons, and route the click through a new close_tab_by_id helper that calls BrowserCore::close_tab(tab_id) directly. --- crates/ely_app/src/shell/chrome/sidebar.rs | 10 +++------- crates/ely_app/src/shell/tab_lifecycle.rs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/crates/ely_app/src/shell/chrome/sidebar.rs b/crates/ely_app/src/shell/chrome/sidebar.rs index 692b82d..46ed212 100644 --- a/crates/ely_app/src/shell/chrome/sidebar.rs +++ b/crates/ely_app/src/shell/chrome/sidebar.rs @@ -271,6 +271,7 @@ impl ElyShell { .id(close_id) .size(px(16.0)) .rounded(px(4.0)) + .flex_shrink_0() .flex() .items_center() .justify_center() @@ -280,11 +281,7 @@ impl ElyShell { .hover(|style| style.bg(rgba(0x281e1414)).text_color(rgb(colors::INK))) .cursor_pointer() .on_click(cx.listener(move |shell, _, window, cx| { - // Close the tab without bubbling to the launcher row's - // own on_click — otherwise the row tries to re-select - // the tab right after we've closed it. - shell.select_tab(&close_tab_id, window, cx); - shell.close_active_tab(window, cx); + shell.close_tab_by_id(&close_tab_id, window, cx); cx.stop_propagation(); })) .child(IconName::Close), @@ -386,8 +383,7 @@ impl ElyShell { .hover(|style| style.bg(rgba(0x281e1414)).text_color(rgb(colors::INK))) .cursor_pointer() .on_click(cx.listener(move |shell, _, window, cx| { - shell.select_tab(&close_tab_id, window, cx); - shell.close_active_tab(window, cx); + shell.close_tab_by_id(&close_tab_id, window, cx); cx.stop_propagation(); })) .child(IconName::Close), diff --git a/crates/ely_app/src/shell/tab_lifecycle.rs b/crates/ely_app/src/shell/tab_lifecycle.rs index d4e2446..1235434 100644 --- a/crates/ely_app/src/shell/tab_lifecycle.rs +++ b/crates/ely_app/src/shell/tab_lifecycle.rs @@ -33,4 +33,24 @@ impl ElyShell { cx.notify(); } } + + /// Close a specific tab by id. Used by the per-row close (×) on + /// vertical tabs and launcher rows: closing the tab the user + /// targeted directly, instead of the prior select-then-close + /// dance which depended on `close_active_tab` doing the right + /// thing after a fresh selection (and which silently no-op'd if + /// the active tab routed into split-view close logic). + pub(super) fn close_tab_by_id( + &mut self, + tab_id: &TabId, + window: &mut Window, + cx: &mut Context, + ) { + if let ShellState::Ready(core) = &mut self.state + && core.close_tab(tab_id).is_ok() + { + self.sync_address_input(window, cx); + cx.notify(); + } + } }