Container Widget Drop Testing Guide

Step-by-step guide to test widget nesting functionality

Container Widget Drop Testing Guide

Test Scenario 1: Palette → Container (Creating NEW widgets) ✅

Steps:

  1. Open the editor at http://localhost:5200/editor

  2. Create a Container Widget:

    • Drag "Container" from the Widget Library (left panel)
    • Drop it on the canvas
    • The container should appear with "Contenedor vacío" message
  3. Drag a NEW widget from palette:

    • Find "Text Widget" in the Widget Library
    • Start dragging it
    • Hover over the container widget

Expected Console Logs:

[DropZone] handleDragEnter called
[ContainerWidget] 🔵 onDropEnter - widget hovering over container
[DropZone] handleDragOver called
[ContainerWidget] onDropOver
  1. Drop the widget inside the container:
    • Release the mouse

Expected Console Logs:

[Canvas] Drop target is inside container - letting container handle it
[DropZone] handleDrop called
[ContainerWidget] 🎯 onDropped called!
[ContainerWidget] ✅ Creating widget from drop
[ContainerWidget] Widget created

Expected Result:


Test Scenario 2: Existing Widget → Container (Re-parenting) ⚠️

Current Status: NOT IMPLEMENTED YET

This scenario requires additional work:

  1. ResponsiveDraggableDirective uses mouse events (not HTML5 drag)
  2. Container DropZoneDirective expects HTML5 drag events
  3. These two systems are incompatible

Workaround (Manual Parent Selection):

A UI control will be added to the properties panel to manually change a widget's parent.


Debugging Tips

If drop doesn't work:

  1. Check console for logs - Look for:

    • [DropZone] handleDrop called
    • [ContainerWidget] onDropped called
  2. Check container config:

    • Open browser DevTools
    • Select the container element
    • Check if allowDrop: true in the component
  3. Check z-index:

    • Container should have z-index: 5
    • Canvas children should have z-index: 2
  4. Check pointer-events:

    • Container should have pointer-events: auto
    • Drop zone should be active

Common Issues:

Issue Solution
No console logs Canvas is intercepting events - check onDragOver and onDrop
"Drop rejected - no dragData" Widget palette not setting dataTransfer correctly
Widget appears on canvas, not in container Canvas handleDrop is running instead of container
Container not visible Check empty-container styles and min-height

Next Steps

  1. ✅ Test Palette → Container
  2. ⏳ Add Parent Selector UI (Option C)
  3. ⏳ Implement Drag-based Re-parenting (Option A)

Session: 12.12
Status: Testing in progress