From 135da402ef0035ce5a44d4a5d5d73d576e92bc82 Mon Sep 17 00:00:00 2001 From: Maribeth Moffatt Date: Mon, 19 May 2025 17:18:38 -0700 Subject: [PATCH] fix: focus something after deleting a block (#9073) --- core/block_svg.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/block_svg.ts b/core/block_svg.ts index ea5dd7da7..f8e37fcc9 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -849,6 +849,17 @@ export class BlockSvg Tooltip.dispose(); ContextMenu.hide(); + // If this block was focused, focus its parent or workspace instead. + const focusManager = getFocusManager(); + if (focusManager.getFocusedNode() === this) { + const parent = this.getParent(); + if (parent) { + focusManager.focusNode(parent); + } else { + focusManager.focusTree(this.workspace); + } + } + if (animate) { this.unplug(healStack); blockAnimations.disposeUiEffect(this);