Skip to content

Commit 2e448bf

Browse files
Close flyout when navigating from toolbox (#2)
This really helps with the route to the MakeCode sim and matches the behaviour on RaspberryPiFoundation#225
1 parent e82446f commit 2e448bf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ export class KeyboardNavigation {
5757
* be added to.
5858
* @param options Options.
5959
*/
60-
constructor(
61-
workspace: Blockly.WorkspaceSvg,
62-
options: NavigationOptions,
63-
) {
60+
constructor(workspace: Blockly.WorkspaceSvg, options: NavigationOptions) {
6461
this.workspace = workspace;
6562

6663
// Regularise options and apply defaults.
@@ -179,6 +176,13 @@ export class KeyboardNavigation {
179176
*/
180177
onExternalToolboxBlur(): void {
181178
this.workspace.keyboardAccessibilityMode = true;
179+
if (
180+
this.navigationController.navigation.getState(this.workspace) !==
181+
Constants.STATE.FLYOUT
182+
) {
183+
// We can likely call blurToolboxAndFlyout once https://github.com/google/blockly-keyboard-experimentation/pull/225 lands
184+
this.navigationController.navigation.resetFlyout(this.workspace, true);
185+
}
182186
}
183187

184188
/**

0 commit comments

Comments
 (0)