Skip to content

Commit 233604a

Browse files
authored
fix: focus for autohideable flyouts (#8990)
1 parent bbd97ea commit 233604a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

core/interfaces/i_autohideable.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ export interface IAutoHideable extends IComponent {
2020
*/
2121
autoHide(onlyClosePopups: boolean): void;
2222
}
23+
24+
/** Returns true if the given object is autohideable. */
25+
export function isAutoHideable(obj: any): obj is IAutoHideable {
26+
return obj.autoHide !== undefined;
27+
}

core/workspace_svg.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {getFocusManager} from './focus_manager.js';
4141
import {Gesture} from './gesture.js';
4242
import {Grid} from './grid.js';
4343
import type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';
44+
import {isAutoHideable} from './interfaces/i_autohideable.js';
4445
import type {IBoundedElement} from './interfaces/i_bounded_element.js';
4546
import {IContextMenu} from './interfaces/i_contextmenu.js';
4647
import type {IDragTarget} from './interfaces/i_drag_target.js';
@@ -2765,7 +2766,7 @@ export class WorkspaceSvg
27652766
if (flyout && nextTree === flyout) return;
27662767
if (toolbox && nextTree === toolbox) return;
27672768
if (toolbox) toolbox.clearSelection();
2768-
if (flyout && flyout instanceof Flyout) flyout.autoHide(false);
2769+
if (flyout && isAutoHideable(flyout)) flyout.autoHide(false);
27692770
}
27702771
}
27712772
}

0 commit comments

Comments
 (0)