Skip to content

Commit 036ef73

Browse files
committed
retain focus on tab merges etc
1 parent 36da733 commit 036ef73

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

apps/array/src/renderer/features/panels/hooks/useDragDropHandlers.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ const isSplitDirection = (zone: string): zone is SplitDirection => {
1111
};
1212

1313
export const useDragDropHandlers = (taskId: string) => {
14-
const { moveTab, splitPanel, setDraggingTab, reorderTabs, getLayout } =
15-
usePanelLayoutStore();
14+
const {
15+
moveTab,
16+
splitPanel,
17+
setDraggingTab,
18+
reorderTabs,
19+
getLayout,
20+
setFocusedPanel,
21+
} = usePanelLayoutStore();
1622

1723
const handleDragStart = (event: any) => {
1824
const data = event.operation.source?.data;
@@ -86,8 +92,12 @@ export const useDragDropHandlers = (taskId: string) => {
8692

8793
if (zone === "center") {
8894
moveTab(taskId, tabId, sourcePanelId, targetPanelId);
95+
setFocusedPanel(taskId, targetPanelId);
8996
} else if (isSplitDirection(zone)) {
9097
splitPanel(taskId, tabId, sourcePanelId, targetPanelId, zone);
98+
// For splits, the new panel gets a generated ID, so we can't easily focus it here
99+
// The target panel remains focused which is reasonable behavior
100+
setFocusedPanel(taskId, targetPanelId);
91101
}
92102
};
93103

0 commit comments

Comments
 (0)