Overview

Postponed on #3458503: Improve the page hierarchy display which adds SortableJS behavior to the Layers menu and the basic implementation. This issue is to refine the dragging behavior and also the design.

A few things I've encountered so far:

- Dragging a component to the root level, only sometimes shows the ghost styling, and sometimes will add a left margin
- Hard to drag into an unopened slot (where the dropdown is closed)
- Hard to drag a component into an empty slot
- Prevent dragging a component into an SDC unless it's into the SDC's slot.

From: https://www.drupal.org/project/experience_builder/issues/3458503#comment...

Detailed observations, none of which need to be addressed here, only in follow-ups:

the slot names are machine names, not human-readable names
clicking on a slot name doesn't do anything — I'd expect the entire slot to be outlined?
the slot names are bold: why do we want to make them visually stand out compared to components? Especially due to the above point, I'd expect them to have less visual prominence.
clicking the slot name doesn't do the same as clicking the disclosure triangle

Proposed resolution

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:

  • layers Comparechanges, plain diff MR !275
  • 1 hidden branch
  • 3470594-layers Comparecompare

Comments

hooroomoo created an issue. See original summary.

hooroomoo’s picture

Status: Active » Postponed
hooroomoo’s picture

Issue summary: View changes
hooroomoo’s picture

Title: [PP-1] Refine dragging behavior in Layers menu » [PP-1] Refine dragging behavior and design in Layers menu
wim leers’s picture

Title: [PP-1] Refine dragging behavior and design in Layers menu » Refine dragging behavior and design in Layers menu
Status: Postponed » Active
hooroomoo’s picture

Assigned: Unassigned » hooroomoo

hooroomoo changed the visibility of the branch 3470594-layers to hidden.

hooroomoo’s picture

Assigned: hooroomoo » jessebaker
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new2.02 MB

hooroomoo’s picture

Status: Needs review » Active
hooroomoo’s picture

Assigned: jessebaker » hooroomoo
lauriii’s picture

The red color is kind of confusing. I'm not really sure what it's supposed to indicate. That you can't drag it into that location? I'm not sure if that's the best affordance. It might make sense to just show the closest place where it can be dragged to and avoid showing where it cannot be dragged. I think we should talk to Renee and Jillian from Acquia UX folks to find a solution to this 😇

wim leers’s picture

hooroomoo’s picture

#13 The red/pink color to the clone was for debugging purposes 😅

wim leers’s picture

#15: 🤣 I was hoping you'd say that 😆

hooroomoo’s picture

Jotting notes down here

  1. The more deeply nested you get, the harder it is to place components correctly in the right slots.

    Still needs to be addressed

  2. Several parts of a SortableContainer element with slots have the data-xb-uuid attribute since it is used when an element is being dropped into the slot target that has data-xb-uuid so the dragging knows where the destination is. And also when a component with slots is the one being dragged, the data-xb-uuid is needed to know the origin. I want to see if it is possible to reduce the data-xb-uuid usage.
  3. Add a test that swaps a component with slots with another component with slots
hooroomoo’s picture

Issue summary: View changes
StatusFileSize
new968.07 KB
new1.33 MB

In the last commit, i commented out the css workarounds within the SortableJS initialization and added the ghost class option so we can hopefully find the root cause since the very similar functionality of Sortablejs is working in the preview.

The problem is, when we use the ghostClass, our custom ghost element styling is not being applied when dragging within the same parent. I See chrome gif. But what is strange is it's working in Safari (see Safari gif, other than the weird short blue line that appears on start but thats a later issue).

Both gifs are on the same MR, and showing dragging within a slot, then within the root level.

CHROME GIF our custom ghost does NOT appear:

SAFARI GIF our custom ghost DOES appear:

I first thought maybe SortableJS is having an issue with the DOM structure of each item... but not sure about that anymore if it works in Safari...

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

hooroomoo’s picture

Crediting @balintbrews for finding the cause of the bug. Sortable ghost class styles was being overridden by hovered styles in TreeItem component.

wim leers’s picture

Issue tags: +Usability, +Needs followup

Follow-up idea to elevate the layers UX even more: use actual component previews instead of abstract ghosts when dragging — i.e. like the ones in #3469856-52: The component preview should have a background: include theme's global asset libraries for component preview.

simohell’s picture

Version: » 0.x-dev

Initially I thought that I'm against the idea at #21. I was testing this today for the first time on my own, and I thought that the layer tab is a very good tool for power users and people who need accessible technologies - and this is especially because of being visually cleaner.

But if it would be a per user setting to show or hide previews then it would be an improvement. Another improvement IMO would be to allow navigating from layers to props and back using the keyboard.

Relevant innovations and lessons learned in dragging would be welcome at #2920006: Research accessibility of drag-and-drop grid interfaces.

ctrladel’s picture

Issue tags: +Barcelona2024
StatusFileSize
new167.65 KB
new110.69 KB
new218.29 KB
new72.73 KB

Tried out the interactions on with the current branch and found a few oddities/areas that could be improved. An overall issue I encountered is that it wasn't clear where things could be dropped because there's not a great indicator to tell where valid drop zones are for slots vs a component vs two components next to each other

  • It's confusing that reordering and dropping into a slot have the same styles. I would expect the slot to highlight in someway if a component is going to be placed in it
  • When dropping a component into a closed slot it'd probably be better if that slot opened when a component is placed in it
  • Hovering over a closed slot should open it so I can drop a component deeper into the tree without having to open it first
  • (end-with-slot.mp4)Things get twitchy when trying to drag a component into a slot or to the end of a list when there is an expanded component containing a slot at the end of the list
  • (expanded-no-move.mp4)It's hard to tell if an expanded component will be placed in the same spot because the indicator appears at the bottom of the expanded tree for the component
  • (move-far.mp4)With an expanded tree the indicator can unexpectedly jump quite far down because it's the closest drop target
  • (general-weirdness.mp4)There's some general weirdness with the indicator jumping around
  • The placement indicator isn't visible when it is before/after a selected component
jessebaker’s picture

It would be interesting to know if you can set the e.dataTransfer.setDragImage to point to an iFrame (one that has been scaled too) to achieve the functionality described in #21.

I would be concerned though what we be able to show when dragging empty elements etc once we have the ability to build components. We would still need to be able to fall back to something more abstract like we have now.

Btw the white box with plain text in it that we have now could certainly be styled to look nicer (unless that already happened in the last few days, I've not actually checked!)

hooroomoo’s picture

#23 Thank you for the thorough testing @ctrladel!

This issue addresses noticeable buggy behavior that's currently in head and further improvements to the dragging behavior will be done in a follow-up to get this in sooner since there's always something to tackle with drag and drop functionality.

hooroomoo’s picture

Assigned: Unassigned » jessebaker
Status: Active » Needs review
balintbrews’s picture

balintbrews’s picture

Assigned: jessebaker » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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