From 45683f1a48385d2d76b452388d6c2f0e1e9d7af6 Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Mon, 29 Jul 2024 10:23:55 +0200 Subject: [PATCH] CB-3733 Close data editor tabs with the middle mouse button (#2805) * feat: Add closeOnMouseWheelClick prop to Tab components * fix: close tab on middle mouse button if tab can be closed * fix: closes tabs for Safari also * CB-3733 removes closeOnMouseWheelClick prop --------- Co-authored-by: Evgenia Bezborodova <139753579+EvgeniaBzzz@users.noreply.github.com> --- webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx | 8 +++++++- .../NavigationTabsBar/Tabs/TabHandlerTab.tsx | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx b/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx index daa9094496..9c185a34a1 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx +++ b/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx @@ -27,9 +27,15 @@ export const Tab = observer(function Tab(props) { const styles = useS(style); const canClose = getComputed(() => !!onClose || (tab.closable && tab.state.closable)); + function onMouseUpHandler(event: React.MouseEvent) { + if (event.button === 1 && canClose) { + tab.handleClose(event); + } + } + return ( -
+
(function TabHandlerTab({ tabId, on const handler = useTabHandler(tab.handlerId); const TabHandlerTab = handler.getTabComponent(); + return ; });