From cf3c966170ab1f8690409249c08e6726747a5522 Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Tue, 4 Oct 2022 16:52:36 +0200 Subject: [PATCH] Fix selection after deletion when last container is selected --- src/Components/Editor/Actions/ContainerOperations.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Components/Editor/Actions/ContainerOperations.ts b/src/Components/Editor/Actions/ContainerOperations.ts index 4a7a2be..b5250a9 100644 --- a/src/Components/Editor/Actions/ContainerOperations.ts +++ b/src/Components/Editor/Actions/ContainerOperations.ts @@ -122,6 +122,7 @@ function GetSelectedContainerOnDelete( ): string { const newSelectedContainer = FindContainerById(mainContainerClone, selectedContainerId) ?? parent.children.at(index) ?? + parent.children.at(index - 1) ?? parent; const newSelectedContainerId = newSelectedContainer.properties.id; return newSelectedContainerId;