Skip to content

webv2: regional-guidance reference image never accepts gallery drops (nested DndContext) #141

Description

@lstein

Found during adversarial review of #140.

The regional-guidance layer's reference-image drop target (workbench/widgets/layers/RegionalGuidanceSettings.tsx, droppable ~line 508, monitor ~line 303) renders inside LayerPropertiesPopover, which sits inside the nested DndContext that LayerGroupSection creates for layer reordering. The Chakra Portal moves DOM but React context follows the React tree, so the field's useGalleryImageDroppable/useDndMonitor bind to the layer-reorder context — while gallery-item drags live in WorkbenchShell's outer context. Its active is therefore always null for gallery drags: the droppable is permanently disabled and the monitor never sees a gallery drag-end.

Net effect: dragging a gallery image onto the regional-guidance reference thumbnail has never worked (the popover also closes on the outside pointerdown by default). Upload-via-click works fine.

Fix direction: bind the field to the outer context (e.g. hoist the droppable/monitor above the nested DndContext, or drop the nested context in favor of scoped ids on the shell context), keep the popover open during drags, then add the shared DropTargetOverlay affordance from #140 (it was deliberately left off this field there because it could never fire).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LUjUcPHzQCoL7dqgsVzi63

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions