fix: focus for autohideable flyouts (#8990)

This commit is contained in:
Maribeth Moffatt
2025-05-05 15:30:33 -04:00
committed by GitHub
parent bbd97eab67
commit 233604a74a
2 changed files with 7 additions and 1 deletions

View File

@@ -20,3 +20,8 @@ export interface IAutoHideable extends IComponent {
*/
autoHide(onlyClosePopups: boolean): void;
}
/** Returns true if the given object is autohideable. */
export function isAutoHideable(obj: any): obj is IAutoHideable {
return obj.autoHide !== undefined;
}

View File

@@ -41,6 +41,7 @@ import {getFocusManager} from './focus_manager.js';
import {Gesture} from './gesture.js';
import {Grid} from './grid.js';
import type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';
import {isAutoHideable} from './interfaces/i_autohideable.js';
import type {IBoundedElement} from './interfaces/i_bounded_element.js';
import {IContextMenu} from './interfaces/i_contextmenu.js';
import type {IDragTarget} from './interfaces/i_drag_target.js';
@@ -2765,7 +2766,7 @@ export class WorkspaceSvg
if (flyout && nextTree === flyout) return;
if (toolbox && nextTree === toolbox) return;
if (toolbox) toolbox.clearSelection();
if (flyout && flyout instanceof Flyout) flyout.autoHide(false);
if (flyout && isAutoHideable(flyout)) flyout.autoHide(false);
}
}
}