Overview

One of the reasons the drag and drop is a bit fiddly is because elements are moving around the page as components are being dragged. We should avoid this type of shifts until the actual drop has happened to make the whole experience a bit less chaotic.

Proposed resolution

Retain space components take when drag on a component starts. Effects used to show where component gets placed should also not take space from the page.

User interface changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lauriii created an issue. See original summary.

gauravvvv’s picture

Assigned: Unassigned » gauravvvv

gauravvvv’s picture

Assigned: gauravvvv » Unassigned
Status: Active » Needs review
lauriii’s picture

This is a really nice improvement! Thank you @gauravvvv!

wim leers’s picture

Assigned: Unassigned » balintbrews
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: +CSS
StatusFileSize
new276.48 KB

I think this is indeed a clear improvement:

Assigning to @balintbrews for final review 😄

balintbrews made their first commit to this issue’s fork.

balintbrews’s picture

StatusFileSize
new3.67 MB

This looks amazing! 🤩

I added a small commit to address two minor things:

  1. Increase contrast between ghost element and already placed elements by slightly decreasing opacity;
  2. Set a minimum height for the ghost element to account for newly added components where we won't have any markup rendered yet and all we have is a placeholder.

Adding a new component to a slot

What would be nice, and I couldn't quickly find the selector for it, is to hide the name of a newly added component inside the ghost element. See on my screen capture. @gauravvvv, would you be up for taking a stab at that? If we can't easily make it happen, let's center that element inside the ghost wrapper for now, so it looks like it's intentionally there. You can do that by adding:

.sortable-ghost {
  /* ... */
  display: flex;
  justify-content: center;
  align-items: center;
}
balintbrews’s picture

Status: Reviewed & tested by the community » Needs work
wim leers’s picture

Assigned: balintbrews » Unassigned
lauriii’s picture

I'm wondering if we should just land this regardless of #8? I think we need a follow-up to improve the design for the scenario where a new component is being added anyway because I think we can improve it further than what's proposed in #8.

balintbrews’s picture

@lauriii, sure, that's why I proposed the fallback solution that makes things better immediately. 🙂 Let me push that commit quickly, then we can wrap this up.

balintbrews’s picture

Status: Needs work » Needs review
lauriii’s picture

Status: Needs review » Reviewed & tested by the community

This looks good! We probably need couple more issues to further refine this but this is a big step forward 👍

  • Wim Leers committed 4de3c89b on 0.x authored by gauravvvv
    Issue #3469895 by balintbrews, gauravvvv: Retain the space consumed by a...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.