From 4c5702dd474ba701eda490c563df996c64eede1e Mon Sep 17 00:00:00 2001 From: pavanmanishd Date: Tue, 9 Jun 2026 13:53:10 +0100 Subject: [PATCH] Close tab on middle-click (#9767) Closes #9699. --- docs/en_US/release_notes_9_16.rst | 2 ++ web/pgadmin/static/js/helpers/Layout/index.jsx | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/en_US/release_notes_9_16.rst b/docs/en_US/release_notes_9_16.rst index fbb0d6e48..54de6464e 100644 --- a/docs/en_US/release_notes_9_16.rst +++ b/docs/en_US/release_notes_9_16.rst @@ -20,6 +20,8 @@ Bundled PostgreSQL Utilities New features ************ + | `Issue #9699 `_ - Add support for closing a tab with a middle-click on its title. + Housekeeping ************ diff --git a/web/pgadmin/static/js/helpers/Layout/index.jsx b/web/pgadmin/static/js/helpers/Layout/index.jsx index 9522964f9..f0955622b 100644 --- a/web/pgadmin/static/js/helpers/Layout/index.jsx +++ b/web/pgadmin/static/js/helpers/Layout/index.jsx @@ -54,6 +54,13 @@ export function TabTitle({id, closable, defaultInternal}) { layoutDocker.eventBus.fireEvent(LAYOUT_EVENTS.CONTEXT, e, id); }, []); + const onMouseDown = useCallback((e)=>{ + if(closable && e.button === 1) { + e.preventDefault(); + layoutDocker.close(id); + } + }, [closable, id, layoutDocker]); + useEffect(()=>{ // Initialize visibility immediately once the effect runs and layoutObj is available setIsVisible(layoutDocker?.isTabVisible(id) ?? false); @@ -119,7 +126,7 @@ export function TabTitle({id, closable, defaultInternal}) { }, []); return ( - + {attrs.icon && } {showServerColorIndicator && attrs.bgcolor && !isVisible && (