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:
Open the editor at
http://localhost:5200/editorCreate 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
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
- 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:
- ✅ Text widget appears INSIDE the container
- ✅ Widget Tree shows Text as child of Container
- ✅ Container's
childrenarray includes the text widget ID
Test Scenario 2: Existing Widget → Container (Re-parenting) ⚠️
Current Status: NOT IMPLEMENTED YET
This scenario requires additional work:
- ResponsiveDraggableDirective uses mouse events (not HTML5 drag)
- Container DropZoneDirective expects HTML5 drag events
- 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:
Check console for logs - Look for:
[DropZone] handleDrop called[ContainerWidget] onDropped called
Check container config:
- Open browser DevTools
- Select the container element
- Check if
allowDrop: truein the component
Check z-index:
- Container should have
z-index: 5 - Canvas children should have
z-index: 2
- Container should have
Check pointer-events:
- Container should have
pointer-events: auto - Drop zone should be active
- Container should have
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
- ✅ Test Palette → Container
- ⏳ Add Parent Selector UI (Option C)
- ⏳ Implement Drag-based Re-parenting (Option A)
Session: 12.12
Status: Testing in progress