You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by en...@apache.org on 2026/08/06 16:20:17 UTC

(superset) 08/18: feat(dashboard-v2): make the palette drag, and let a block be removed

This is an automated email from the ASF dual-hosted git repository.

EnxDev pushed a commit to branch dashboard-v2
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 5c8b3d2e313eef2934036a48e9baa54d14da31c5
Author: Enzo Martellucci <en...@gmail.com>
AuthorDate: Thu Aug 6 09:38:33 2026 +0200

    feat(dashboard-v2): make the palette drag, and let a block be removed
    
    Three things, one of them a defect this shell introduced.
    
    The palette rows carried a drag grip beside every label and no drag.
    They are draggable now, onto any container rather than only the root: a
    nested section is exactly where an author means to put something when
    they drag it there, and the innermost container under the pointer takes
    the drop rather than every ancestor claiming it. The payload is a
    private type, so a dragged file or a selection of text from another
    window is not read as a request to place a block.
    
    Both ways of asking now go through one `placeBlock`. Two copies of what
    a freshly placed block looks like is how a block dropped into a section
    ends up subtly different from the same block clicked into it, and the
    difference stays invisible until someone hits it.
    
    Blocks gained a remove control in their top-right corner, shown while
    the block is hovered or selected rather than permanently — a delete on
    every block at all times is a row of delete buttons where a dashboard
    should be. It is excluded from the grid's drag via `draggableCancel`,
    because react-grid-layout starts a drag on a press anywhere in the block
    it positions and aiming at the X would otherwise drag what it is
    attached to. The root has none: removing it is refused by the provider,
    so offering the button would be offering an error.
    
    The palette's search field is also set down from the tab bar and in from
    the panel edge, where flush against both it read as chrome around the
    list rather than the way into it.
    
    Co-Authored-By: Claude Opus 5 <no...@anthropic.com>
---
 .../src/core/dashboard/BuildingBlockView.tsx       |  70 ++++++++++++++
 .../src/core/dashboard/blocks/CanvasBlock.test.tsx | 104 +++++++++++++++++++++
 .../src/core/dashboard/blocks/CanvasBlock.tsx      |  23 ++++-
 .../src/core/dashboard/blocks/FlexCanvas.tsx       |  18 ++++
 superset-frontend/src/core/dashboard/placement.ts  |  71 ++++++++++++++
 .../pages/DashboardBuilderV2/EditorPanel.test.tsx  |  27 ++++++
 .../src/pages/DashboardBuilderV2/Palette.tsx       |  23 ++++-
 .../src/pages/DashboardBuilderV2/index.tsx         |  27 ++----
 8 files changed, 343 insertions(+), 20 deletions(-)

diff --git a/superset-frontend/src/core/dashboard/BuildingBlockView.tsx b/superset-frontend/src/core/dashboard/BuildingBlockView.tsx
index 2a22d4884e0..28dc2c0a4ae 100644
--- a/superset-frontend/src/core/dashboard/BuildingBlockView.tsx
+++ b/superset-frontend/src/core/dashboard/BuildingBlockView.tsx
@@ -20,6 +20,7 @@ import { forwardRef, type HTMLAttributes } from 'react';
 import { t } from '@apache-superset/core/translation';
 import { useTheme } from '@apache-superset/core/theme';
 import { Flex, Typography } from '@superset-ui/core/components';
+import { Icons } from '@superset-ui/core/components/Icons';
 import { ErrorBoundary } from 'src/components';
 import { provider, useDashboardRevision } from './store';
 import { resolveBuildingBlockView } from './resolveBuildingBlockView';
@@ -92,6 +93,9 @@ const BuildingBlockView = forwardRef<HTMLDivElement, BuildingBlockViewProps>(
 
     const resolved = resolveBuildingBlockView(node.type, nodeId);
     const selected = provider.getSelection() === nodeId;
+    // The root holds the dashboard; removing it is refused by the provider,
+    // so offering the button would be offering a error.
+    const removable = nodeId !== provider.getRoot().id;
 
     return (
       <div
@@ -128,12 +132,78 @@ const BuildingBlockView = forwardRef<HTMLDivElement, BuildingBlockViewProps>(
         }}
         style={{
           ...rest.style,
+          // The remove control anchors to this element. react-grid-layout
+          // positions its children itself, so its own value is kept wherever
+          // it set one and `relative` only fills the gap when it did not.
+          position: rest.style?.position ?? 'relative',
           // Drawn over the block rather than around it: an outline takes no
           // space, so nothing on screen shifts when a selection moves.
           outline: selected ? `2px solid ${theme.colorPrimary}` : undefined,
           outlineOffset: selected ? -2 : undefined,
         }}
       >
+        {/* Removing a block, where the block is.
+            Nested inside a control, which is not ideal and is the price of
+            the wrapper itself being selectable — the alternative was a block
+            you can delete only from the panel. The keyboard path is not this
+            button: the Outline selects any block with proper tree semantics
+            and Properties carries the same Delete.
+
+            `data-block-remove` is what keeps a press on it from starting a
+            react-grid-layout drag; see CanvasBlock's `draggableCancel`. The
+            propagation stops are the same idea for the two gestures this
+            element sits inside: a click here removes rather than selects,
+            and a pointer down here grabs nothing. */}
+        {removable && (
+          <button
+            type="button"
+            data-block-remove
+            data-test={`block-remove-${nodeId}`}
+            aria-label={t('Remove block')}
+            title={t('Remove block')}
+            onMouseDown={event => event.stopPropagation()}
+            onPointerDown={event => event.stopPropagation()}
+            onClick={event => {
+              event.stopPropagation();
+              provider.removeBuildingBlock(nodeId);
+            }}
+            style={{
+              position: 'absolute',
+              top: theme.sizeUnit,
+              right: theme.sizeUnit,
+              zIndex: 2,
+              display: 'flex',
+              alignItems: 'center',
+              justifyContent: 'center',
+              width: theme.sizeUnit * 5,
+              height: theme.sizeUnit * 5,
+              padding: 0,
+              border: `1px solid ${theme.colorBorder}`,
+              borderRadius: theme.borderRadius,
+              background: theme.colorBgContainer,
+              color: theme.colorTextTertiary,
+              cursor: 'pointer',
+              // Shown once the block is in hand — hovered or selected — rather
+              // than permanently: a delete on every block at all times is a
+              // row of delete buttons where a dashboard should be.
+              opacity: selected ? 1 : 0,
+            }}
+            onFocus={event => {
+              event.currentTarget.style.opacity = '1';
+            }}
+            onBlur={event => {
+              event.currentTarget.style.opacity = selected ? '1' : '0';
+            }}
+            onMouseEnter={event => {
+              event.currentTarget.style.opacity = '1';
+            }}
+            onMouseLeave={event => {
+              event.currentTarget.style.opacity = selected ? '1' : '0';
+            }}
+          >
+            <Icons.CloseOutlined iconSize="s" />
+          </button>
+        )}
         <div style={{ width: '100%', height: '100%' }}>
           <ErrorBoundary>
             {resolved ?? <UnsupportedBlockPlaceholder nodeId={nodeId} />}
diff --git a/superset-frontend/src/core/dashboard/blocks/CanvasBlock.test.tsx b/superset-frontend/src/core/dashboard/blocks/CanvasBlock.test.tsx
index 660f36107d3..1408b0fc60c 100644
--- a/superset-frontend/src/core/dashboard/blocks/CanvasBlock.test.tsx
+++ b/superset-frontend/src/core/dashboard/blocks/CanvasBlock.test.tsx
@@ -36,15 +36,18 @@ jest.mock('react-grid-layout/legacy', () => ({
     children,
     compactType,
     allowOverlap,
+    draggableCancel,
   }: {
     children: React.ReactNode;
     compactType: string | null;
     allowOverlap?: boolean;
+    draggableCancel?: string;
   }) => (
     <div
       data-test="rgl"
       data-compact-type={String(compactType)}
       data-allow-overlap={String(!!allowOverlap)}
+      data-draggable-cancel={draggableCancel ?? ''}
     >
       {children}
     </div>
@@ -145,3 +148,104 @@ test('a flex child dropped on itself changes nothing', () => {
 
   expect(provider.getNode(rootId)?.children).toEqual([first, second]);
 });
+
+/** A drag payload jsdom's synthetic events do not carry on their own. */
+const paletteTransfer = (type: string) => {
+  const data = new Map([['application/x-dashboard-building-block', type]]);
+  return {
+    types: [...data.keys()],
+    getData: (key: string) => data.get(key) ?? '',
+    setData: (key: string, value: string) => data.set(key, value),
+    dropEffect: '',
+    effectAllowed: '',
+  };
+};
+
+test('dropping a palette block on a container places it there', () => {
+  const { rootId } = withMode('grid');
+
+  fireEvent.drop(screen.getByTestId('canvas-container'), {
+    dataTransfer: paletteTransfer('markdown'),
+  });
+
+  const children = provider.getNode(rootId)?.children ?? [];
+  expect(children).toHaveLength(3);
+  expect(provider.getNode(children[2])?.type).toBe('markdown');
+});
+
+test('a drop into a flex container lands there too', () => {
+  const { rootId } = withMode('flex');
+
+  fireEvent.drop(screen.getByTestId('flex-canvas'), {
+    dataTransfer: paletteTransfer('echarts'),
+  });
+
+  const children = provider.getNode(rootId)?.children ?? [];
+  expect(provider.getNode(children[children.length - 1])?.type).toBe('echarts');
+});
+
+test('a drop carrying something else is not read as a block', () => {
+  const { rootId } = withMode('grid');
+  const before = provider.getNode(rootId)?.children?.length;
+
+  fireEvent.drop(screen.getByTestId('canvas-container'), {
+    dataTransfer: {
+      types: ['text/plain'],
+      getData: () => '',
+      dropEffect: '',
+      effectAllowed: '',
+    },
+  });
+
+  // A private type rather than text/plain is what keeps a dragged file, or a
+  // selection of text from another window, from placing a block.
+  expect(provider.getNode(rootId)?.children?.length).toBe(before);
+});
+
+test('a placed block offers a way to remove it, and the root does not', () => {
+  const { rootId, first } = withMode('grid');
+
+  expect(screen.getByTestId(`block-remove-${first}`)).toBeInTheDocument();
+  // Removing the root is refused by the provider, so offering the button
+  // would be offering an error.
+  expect(
+    screen.queryByTestId(`block-remove-${rootId}`),
+  ).not.toBeInTheDocument();
+});
+
+test('the remove control removes that block and nothing else', () => {
+  const { rootId, first, second } = withMode('grid');
+
+  fireEvent.click(screen.getByTestId(`block-remove-${first}`));
+
+  expect(provider.getNode(rootId)?.children).toEqual([second]);
+});
+
+test('the grid is told not to start a drag from the remove control', () => {
+  const { first } = withMode('grid');
+
+  // react-grid-layout begins a drag on a press anywhere in the block it is
+  // positioning, and the button sits inside that block. `draggableCancel` is
+  // what it reads to exclude a region, so the selector and the attribute the
+  // button carries have to agree — aiming at the X would otherwise drag the
+  // block it is attached to.
+  const cancel = screen
+    .getByTestId('rgl')
+    .getAttribute('data-draggable-cancel');
+  expect(cancel).toContain('[data-block-remove]');
+  expect(screen.getByTestId(`block-remove-${first}`)).toHaveAttribute(
+    'data-block-remove',
+  );
+});
+
+test('clicking the remove control removes rather than selects', () => {
+  const { first, second } = withMode('grid');
+
+  fireEvent.click(screen.getByTestId(`block-remove-${second}`));
+
+  // The wrapper selects on click and the button sits inside it. Without the
+  // stop, removing a block would also try to select the thing just removed.
+  expect(provider.getSelection()).toBeUndefined();
+  expect(provider.getNode(second)).toBeUndefined();
+  expect(provider.getNode(first)).toBeDefined();
+});
diff --git a/superset-frontend/src/core/dashboard/blocks/CanvasBlock.tsx b/superset-frontend/src/core/dashboard/blocks/CanvasBlock.tsx
index 3ab27e20dcf..1dfc1d7142e 100644
--- a/superset-frontend/src/core/dashboard/blocks/CanvasBlock.tsx
+++ b/superset-frontend/src/core/dashboard/blocks/CanvasBlock.tsx
@@ -29,6 +29,7 @@ import { useTheme } from '@apache-superset/core/theme';
 import { provider, useDashboardRevision } from '../store';
 import { resolveGridMetrics, resolveLayoutMode } from '../layoutStyle';
 import { packChildLayout } from '../gridPacking';
+import { PALETTE_MIME, placeBlock } from '../placement';
 import BuildingBlockView from '../BuildingBlockView';
 import FlexCanvas from './FlexCanvas';
 
@@ -239,6 +240,26 @@ export default function CanvasBlock({ nodeId }: { nodeId: string }) {
   return (
     <div
       data-container-id={nodeId}
+      data-test="canvas-container"
+      // Every container is a drop target, not just the root: a nested
+      // section is exactly where an author means to put something when they
+      // drag it there, and the stop is what makes the innermost container
+      // under the pointer the one that takes it rather than every ancestor
+      // claiming the same drop.
+      onDragOver={event => {
+        if (event.dataTransfer.types.includes(PALETTE_MIME)) {
+          event.preventDefault();
+          event.dataTransfer.dropEffect = 'copy';
+        }
+      }}
+      onDrop={event => {
+        const type = event.dataTransfer.getData(PALETTE_MIME);
+        if (type !== '') {
+          event.preventDefault();
+          event.stopPropagation();
+          placeBlock(nodeId, type);
+        }
+      }}
       style={{ width: '100%', height: '100%', overflow: 'auto' }}
     >
       <ResizableGridLayout
@@ -286,7 +307,7 @@ export default function CanvasBlock({ nodeId }: { nodeId: string }) {
         // `data-container-id` itself, so this never affects dragging a
         // leaf — only a nested canvas becomes un-draggable as a whole via
         // a body click (it's still resizable via its own corner handles).
-        draggableCancel="[data-container-id]"
+        draggableCancel="[data-container-id],[data-block-remove]"
         onDragStart={handleDragStart}
         onDragStop={handleDragStop}
         onResizeStart={handleResizeStart}
diff --git a/superset-frontend/src/core/dashboard/blocks/FlexCanvas.tsx b/superset-frontend/src/core/dashboard/blocks/FlexCanvas.tsx
index 356be5dd789..a71c76a4578 100644
--- a/superset-frontend/src/core/dashboard/blocks/FlexCanvas.tsx
+++ b/superset-frontend/src/core/dashboard/blocks/FlexCanvas.tsx
@@ -26,6 +26,7 @@ import {
   resolveFlexBasis,
   resolveFlexMetrics,
 } from '../layoutStyle';
+import { PALETTE_MIME, placeBlock } from '../placement';
 import BuildingBlockView from '../BuildingBlockView';
 
 type LayoutProps = dashboardApi.LayoutProps;
@@ -91,6 +92,23 @@ export default function FlexCanvas({
     <div
       data-container-id={nodeId}
       data-test="flex-canvas"
+      // A flex container takes a palette drop like every other container. Its
+      // own children carry a different payload, so a reorder within the line
+      // and a placement from the palette never read as each other.
+      onDragOver={event => {
+        if (event.dataTransfer.types.includes(PALETTE_MIME)) {
+          event.preventDefault();
+          event.dataTransfer.dropEffect = 'copy';
+        }
+      }}
+      onDrop={event => {
+        const type = event.dataTransfer.getData(PALETTE_MIME);
+        if (type !== '') {
+          event.preventDefault();
+          event.stopPropagation();
+          placeBlock(nodeId, type);
+        }
+      }}
       style={{
         display: 'flex',
         width: '100%',
diff --git a/superset-frontend/src/core/dashboard/placement.ts b/superset-frontend/src/core/dashboard/placement.ts
new file mode 100644
index 00000000000..80830d06b96
--- /dev/null
+++ b/superset-frontend/src/core/dashboard/placement.ts
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @fileoverview Placing a new block, in the one place both ways of asking
+ * for it can reach.
+ *
+ * A block arrives on a dashboard two ways — clicked in the palette, or
+ * dragged from it onto a container — and they must produce the same node. Two
+ * copies of "what a freshly placed block looks like" is how a block dropped
+ * into a section ends up subtly different from the same block clicked into
+ * it, and the difference is invisible until someone hits it.
+ */
+
+import { isContainerType } from './DashboardProvider';
+import { DEFAULT_COLUMNS } from './layoutStyle';
+import { provider } from './store';
+
+/**
+ * What a palette drag carries.
+ *
+ * A private type rather than `text/plain` so a drop of anything else — a
+ * file, a selection of text, a drag from another application — is not read
+ * as a request to place a block.
+ */
+export const PALETTE_MIME = 'application/x-dashboard-building-block';
+
+/**
+ * Places a new block of `type` at the end of `parentId`'s children and
+ * selects it, returning its id.
+ *
+ * A container arrives with the grid every other container defaults to, so a
+ * nested canvas is usable the moment it lands rather than needing its columns
+ * set before anything can go inside it. Selecting what was just placed is
+ * what brings its properties forward: placing something is the moment you
+ * want to configure it.
+ */
+export function placeBlock(parentId: string, type: string): string {
+  const index = provider.getNode(parentId)?.children?.length ?? 0;
+  const id = provider.addBuildingBlock(parentId, index, {
+    type,
+    ...(isContainerType(type)
+      ? {
+          layout: {
+            columns: DEFAULT_COLUMNS,
+            gap: 16,
+            colSpan: DEFAULT_COLUMNS,
+            rowSpan: 4,
+          },
+        }
+      : {}),
+  });
+  provider.setSelection(id);
+  return id;
+}
diff --git a/superset-frontend/src/pages/DashboardBuilderV2/EditorPanel.test.tsx b/superset-frontend/src/pages/DashboardBuilderV2/EditorPanel.test.tsx
index 5260047624f..b5fdce76afb 100644
--- a/superset-frontend/src/pages/DashboardBuilderV2/EditorPanel.test.tsx
+++ b/superset-frontend/src/pages/DashboardBuilderV2/EditorPanel.test.tsx
@@ -191,3 +191,30 @@ test('the handle reports the width it actually has', () => {
     '500',
   );
 });
+
+test('the search field is set in from the panel edge and down from the tabs', () => {
+  mount();
+
+  // Flush against both, it reads as chrome around the list rather than the
+  // way into it.
+  expect(screen.getByTestId('palette')).toHaveStyle('padding-top: 12px');
+});
+
+test('a palette row can actually be dragged, as its grip promises', () => {
+  mount();
+  const row = screen.getByTestId('palette-markdown');
+  const setData = jest.fn();
+
+  // The grip beside the label promised a drag the row did not carry.
+  expect(row).toHaveAttribute('draggable', 'true');
+  row.dispatchEvent(
+    Object.assign(new Event('dragstart', { bubbles: true }), {
+      dataTransfer: { setData, effectAllowed: '' },
+    }),
+  );
+
+  expect(setData).toHaveBeenCalledWith(
+    'application/x-dashboard-building-block',
+    'markdown',
+  );
+});
diff --git a/superset-frontend/src/pages/DashboardBuilderV2/Palette.tsx b/superset-frontend/src/pages/DashboardBuilderV2/Palette.tsx
index 91e5d4e9039..e9ccbf94576 100644
--- a/superset-frontend/src/pages/DashboardBuilderV2/Palette.tsx
+++ b/superset-frontend/src/pages/DashboardBuilderV2/Palette.tsx
@@ -25,6 +25,7 @@ import { Icons } from '@superset-ui/core/components/Icons';
 import { views } from 'src/core/views';
 import { DASHBOARD_BUILDING_BLOCKS_LOCATION } from 'src/core/dashboard/resolveBuildingBlockView';
 import { isContainerType } from 'src/core/dashboard/DashboardProvider';
+import { PALETTE_MIME } from 'src/core/dashboard/placement';
 
 /**
  * Which shelf a block sits on.
@@ -160,7 +161,15 @@ export default function Palette({
   return (
     <div
       data-test="palette"
-      style={{ display: 'flex', flexDirection: 'column', gap: theme.sizeUnit }}
+      style={{
+        display: 'flex',
+        flexDirection: 'column',
+        gap: theme.sizeUnit,
+        // Set down from the tab bar and in from the panel edge: a search
+        // field flush against both reads as part of the chrome around the
+        // list rather than the way into it.
+        padding: `${theme.sizeUnit * 3}px ${theme.sizeUnit}px 0`,
+      }}
     >
       <Input
         size="small"
@@ -170,6 +179,7 @@ export default function Palette({
         placeholder={t('Search components…')}
         data-test="palette-search"
         prefix={<Icons.SearchOutlined iconSize="s" />}
+        style={{ marginBottom: theme.sizeUnit }}
         onChange={event => setQuery(event.target.value)}
       />
       {found.length === 0 ? (
@@ -202,9 +212,18 @@ export default function Palette({
                 <button
                   key={entry.type}
                   type="button"
+                  draggable
                   title={entry.description}
                   data-test={`palette-${entry.type}`}
                   onClick={() => onAdd(entry.type)}
+                  // The grip beside the label promised this and did not
+                  // deliver it: the rows carried the affordance of a drag
+                  // without the drag. Clicking still appends to whatever is
+                  // selected; dragging is how an author says *where*.
+                  onDragStart={event => {
+                    event.dataTransfer.setData(PALETTE_MIME, entry.type);
+                    event.dataTransfer.effectAllowed = 'copy';
+                  }}
                   style={{
                     display: 'flex',
                     alignItems: 'center',
@@ -219,7 +238,7 @@ export default function Palette({
                     background: theme.colorBgContainer,
                     color: theme.colorText,
                     fontSize: theme.fontSizeSM,
-                    cursor: 'pointer',
+                    cursor: 'grab',
                   }}
                 >
                   {entry.label}
diff --git a/superset-frontend/src/pages/DashboardBuilderV2/index.tsx b/superset-frontend/src/pages/DashboardBuilderV2/index.tsx
index 25531723818..90eaa94e38c 100644
--- a/superset-frontend/src/pages/DashboardBuilderV2/index.tsx
+++ b/superset-frontend/src/pages/DashboardBuilderV2/index.tsx
@@ -23,7 +23,7 @@ import { Flex, Typography } from '@superset-ui/core/components';
 import { Icons } from '@superset-ui/core/components/Icons';
 import { dashboard, useDashboardRevision } from 'src/core/dashboard';
 import { provider } from 'src/core/dashboard/store';
-import { isContainerType } from 'src/core/dashboard/DashboardProvider';
+import { placeBlock } from 'src/core/dashboard/placement';
 import { chat } from 'src/core/chat';
 import BuildingBlockView from 'src/core/dashboard/BuildingBlockView';
 import { dashboardClientTools } from './clientTools';
@@ -109,29 +109,22 @@ export default function DashboardBuilderV2() {
    *
    * Into whatever is selected when that can hold children, and into the root
    * otherwise. An author who has just selected a section and reaches for a
-   * chart means to put it in that section; one who has selected a chart
-   * means to put the next thing beside it, not inside it.
+   * chart means to put it in that section; one who has selected a chart means
+   * to put the next thing beside it, not inside it.
    *
-   * The new block is then selected, because placing something is the moment
-   * you want to configure it — which is also what brings Properties forward.
+   * A drag from the palette says where for itself — the container it was
+   * dropped on takes it — so only the click needs a target chosen for it.
+   * Both then go through the same `placeBlock`, because two copies of what a
+   * freshly placed block looks like is how the two paths quietly diverge.
    */
   const addBlock = (type: string): void => {
     const selected = provider.getSelection();
     const selectedNode =
       selected === undefined ? undefined : provider.getNode(selected);
-    const parentId =
-      selectedNode?.children !== undefined ? selectedNode.id : root.id;
-    const index = provider.getNode(parentId)?.children?.length ?? 0;
-    const id = dashboard.addBuildingBlock(parentId, index, {
+    placeBlock(
+      selectedNode?.children !== undefined ? selectedNode.id : root.id,
       type,
-      // A container arrives with the grid every other container defaults to,
-      // so a nested canvas is usable the moment it is placed rather than
-      // needing its columns set before anything can go in it.
-      ...(isContainerType(type)
-        ? { layout: { columns: 24, gap: 16, colSpan: 24, rowSpan: 4 } }
-        : {}),
-    });
-    provider.setSelection(id);
+    );
   };
 
   return (