Skip to content

Commit 32c2751

Browse files
fix: always select block after flyout insert (#205)
In MakeCode at least, it's possible to open the flyout by tabbing to the toolbox. In that scenario there is no marker. Because of the early return keyboard nav flow was broken as the new block wasn't selected.
1 parent 165cc10 commit 32c2751

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/navigation.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -600,20 +600,18 @@ export class Navigation {
600600
if (!newBlock) {
601601
return;
602602
}
603-
if (!this.markedNode) {
604-
this.warn('No marked node when inserting from flyout.');
605-
return;
606-
}
607-
if (
608-
!this.tryToConnectNodes(
609-
workspace,
610-
this.markedNode,
611-
Blockly.ASTNode.createBlockNode(newBlock)!,
612-
)
613-
) {
614-
this.warn(
615-
'Something went wrong while inserting a block from the flyout.',
616-
);
603+
if (this.markedNode) {
604+
if (
605+
!this.tryToConnectNodes(
606+
workspace,
607+
this.markedNode,
608+
Blockly.ASTNode.createBlockNode(newBlock)!,
609+
)
610+
) {
611+
this.warn(
612+
'Something went wrong while inserting a block from the flyout.',
613+
);
614+
}
617615
}
618616

619617
this.focusWorkspace(workspace);

0 commit comments

Comments
 (0)