From 8293a66f8f816bd0530deb227da8b19583bdc9bb Mon Sep 17 00:00:00 2001
From: mmenanno <1358708+mmenanno@users.noreply.github.com>
Date: Fri, 29 Aug 2025 18:26:41 -0400
Subject: [PATCH] Add click-to-deselect conversation functionality
- Added click handler to LeftPane for deselecting conversations on empty area clicks
- Provides intuitive alternative to Cmd+Shift+C keyboard shortcut
- Preserves existing functionality for interactive elements
- Includes comprehensive unit tests for the feature
---
ts/components/LeftPane.tsx | 25 ++++
ts/test-electron/components/LeftPane_test.ts | 135 +++++++++++++++++++
2 files changed, 160 insertions(+)
create mode 100644 ts/test-electron/components/LeftPane_test.ts
diff --git a/ts/components/LeftPane.tsx b/ts/components/LeftPane.tsx
index 07e73ec9b6f..2c04f6ce1c2 100644
--- a/ts/components/LeftPane.tsx
+++ b/ts/components/LeftPane.tsx
@@ -546,6 +546,29 @@ export function LeftPane({
[showConversation]
);
+ const handleLeftPaneClick = useCallback(
+ (event: React.MouseEvent) => {
+ const target = event.target as HTMLElement;
+
+ // Only deselect if clicking on empty areas, not on interactive elements
+ if (
+ selectedConversationId &&
+ !target.closest(
+ 'button, input, [role="button"], .module-conversation-list-item, .module-search-results, .module-left-pane-dialog'
+ )
+ ) {
+ event.preventDefault();
+ event.stopPropagation();
+
+ showConversation({
+ conversationId: undefined,
+ messageId: undefined,
+ });
+ }
+ },
+ [selectedConversationId, showConversation]
+ );
+
// We ensure that the listKey differs between some modes (e.g. inbox/archived), ensuring
// that AutoSizer properly detects the new size of its slot in the flexbox. The
// archive explainer text at the top of the archive view causes problems otherwise.
@@ -833,6 +856,7 @@ export function LeftPane({
{preRowsNode &&