File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -856,7 +856,7 @@ export class BlockSvg
856856 if ( parent ) {
857857 focusManager . focusNode ( parent ) ;
858858 } else {
859- focusManager . focusTree ( this . workspace ) ;
859+ setTimeout ( ( ) => focusManager . focusTree ( this . workspace ) , 0 ) ;
860860 }
861861 }
862862
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {IContextMenu} from '../interfaces/i_contextmenu.js';
1919import { ICopyable } from '../interfaces/i_copyable.js' ;
2020import { IDeletable } from '../interfaces/i_deletable.js' ;
2121import { IDraggable } from '../interfaces/i_draggable.js' ;
22+ import { IFocusableNode } from '../interfaces/i_focusable_node.js' ;
2223import type { IFocusableTree } from '../interfaces/i_focusable_tree.js' ;
2324import { IRenderedElement } from '../interfaces/i_rendered_element.js' ;
2425import { ISelectable } from '../interfaces/i_selectable.js' ;
@@ -42,7 +43,8 @@ export class RenderedWorkspaceComment
4243 ISelectable ,
4344 IDeletable ,
4445 ICopyable < WorkspaceCommentCopyData > ,
45- IContextMenu
46+ IContextMenu ,
47+ IFocusableNode
4648{
4749 /** The class encompassing the svg elements making up the workspace comment. */
4850 private view : CommentView ;
@@ -207,7 +209,12 @@ export class RenderedWorkspaceComment
207209 /** Disposes of the view. */
208210 override dispose ( ) {
209211 this . disposing = true ;
212+ const focusManager = getFocusManager ( ) ;
213+ if ( focusManager . getFocusedNode ( ) === this ) {
214+ setTimeout ( ( ) => focusManager . focusTree ( this . workspace ) , 0 ) ;
215+ }
210216 if ( ! this . view . isDeadOrDying ( ) ) this . view . dispose ( ) ;
217+
211218 super . dispose ( ) ;
212219 }
213220
You can’t perform that action at this time.
0 commit comments