mirror of
https://github.com/google/blockly.git
synced 2026-05-19 18:40:11 +02:00
fix!: Flyout follows toolbox in DOM (#9849)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user