Skip to content

Commit

Permalink
Fix missing target cell highlight during grid rearrange (#6554)
Browse files Browse the repository at this point in the history
**Problem:**
Pink target cell highlight is not shown when the dragged item is not
pinned to a cell position.

**Fix:**
This is a regression, we just don't want to show the highlight when the
dragged item is absolute AND not pinned to a cell position.

**Commit Details:** (< vv pls delete this section if's not relevant)

I think we should move these conditions into the strategy, and don't
even set the target cell prop on the control in these cases. As a quick
fix I just fixed the condition in the control.

**Manual Tests:**
I hereby swear that:

- [x] I opened a hydrogen project and it loaded
- [x] I could navigate to various routes in Play mode
  • Loading branch information
gbalint authored and liady committed Dec 13, 2024
1 parent 3119965 commit 03e697a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion editor/src/components/canvas/controls/grid-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,8 @@ const GridControl = React.memo<GridControlProps>(({ grid, controlsVisible }) =>
}`,
}

const dontShowActiveCellHighlight = !targetsAreCellsWithPositioning && anyTargetAbsolute

return (
<React.Fragment>
{/* grid lines */}
Expand All @@ -844,11 +846,12 @@ const GridControl = React.memo<GridControlProps>(({ grid, controlsVisible }) =>
countedColumn === currentHoveredCell?.column &&
countedRow === currentHoveredCell?.row

const activePositioningTarget = isActiveCell && targetsAreCellsWithPositioning
const activePositioningTarget = isActiveCell && !dontShowActiveCellHighlight // TODO: move the logic into runGridRearrangeMove and do not set targetCell prop in these cases

const borderColor = activePositioningTarget
? colorTheme.brandNeonPink.value
: colorTheme.grey65.value

return (
<div
key={id}
Expand Down

0 comments on commit 03e697a

Please sign in to comment.