fix: focus after drag and deleting comments (#9074)

* fix: focus after drag and deleting comments

* chore: fix import
This commit is contained in:
Maribeth Moffatt
2025-05-20 11:58:05 -07:00
committed by GitHub
parent 53d7876539
commit 4f01c9937a
2 changed files with 9 additions and 2 deletions

View File

@@ -856,7 +856,7 @@ export class BlockSvg
if (parent) {
focusManager.focusNode(parent);
} else {
focusManager.focusTree(this.workspace);
setTimeout(() => focusManager.focusTree(this.workspace), 0);
}
}

View File

@@ -19,6 +19,7 @@ import {IContextMenu} from '../interfaces/i_contextmenu.js';
import {ICopyable} from '../interfaces/i_copyable.js';
import {IDeletable} from '../interfaces/i_deletable.js';
import {IDraggable} from '../interfaces/i_draggable.js';
import {IFocusableNode} from '../interfaces/i_focusable_node.js';
import type {IFocusableTree} from '../interfaces/i_focusable_tree.js';
import {IRenderedElement} from '../interfaces/i_rendered_element.js';
import {ISelectable} from '../interfaces/i_selectable.js';
@@ -42,7 +43,8 @@ export class RenderedWorkspaceComment
ISelectable,
IDeletable,
ICopyable<WorkspaceCommentCopyData>,
IContextMenu
IContextMenu,
IFocusableNode
{
/** The class encompassing the svg elements making up the workspace comment. */
private view: CommentView;
@@ -207,7 +209,12 @@ export class RenderedWorkspaceComment
/** Disposes of the view. */
override dispose() {
this.disposing = true;
const focusManager = getFocusManager();
if (focusManager.getFocusedNode() === this) {
setTimeout(() => focusManager.focusTree(this.workspace), 0);
}
if (!this.view.isDeadOrDying()) this.view.dispose();
super.dispose();
}