fix!: Flyout follows toolbox in DOM (#9849)

This commit is contained in:
Michael Harvey
2026-05-11 19:40:04 -04:00
committed by GitHub
parent aa1ec1ede2
commit ae055a460d
3 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ function createMainWorkspace(
if (!wsOptions.hasCategories && wsOptions.languageTree) {
// Add flyout as an <svg> that is a sibling of the workspace SVG.
const flyout = mainWorkspace.addFlyout(Svg.SVG);
dom.insertAfter(flyout, svg);
injectionDiv.insertBefore(flyout, svg);
}
if (wsOptions.hasTrashcan) {
mainWorkspace.addTrashcan();
+1 -1
View File
@@ -156,8 +156,8 @@ export class Toolbox
this.HtmlDiv = this.createDom_(this.workspace_);
const flyoutDom = this.flyout.createDom('svg');
workspace.getInjectionDiv().insertBefore(flyoutDom, svg);
dom.addClass(flyoutDom, 'blocklyToolboxFlyout');
dom.insertAfter(flyoutDom, svg);
this.setVisible(true);
this.flyout.init(workspace);
@@ -216,6 +216,24 @@ suite('Toolbox', function () {
Blockly.getFocusManager().focusNode(this.toolbox.getWorkspace());
assert.isTrue(this.toolbox.getFlyout().isVisible());
});
test('Tab order follows toolbox, flyout, workspace DOM order', function () {
const injectionDiv = this.toolbox.getWorkspace().getInjectionDiv();
const children = Array.from(injectionDiv.children);
const toolboxIndex = children.indexOf(this.toolbox.HtmlDiv);
const flyoutIndex = children.indexOf(this.toolbox.getFlyout().svgGroup_);
const workspaceIndex = children.indexOf(
this.toolbox.getWorkspace().getParentSvg(),
);
assert.isAtLeast(toolboxIndex, 0);
assert.isAtLeast(flyoutIndex, 0);
assert.isAtLeast(workspaceIndex, 0);
assert.isBelow(toolboxIndex, flyoutIndex);
assert.isBelow(flyoutIndex, workspaceIndex);
});
});
suite('onClick_', function () {