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

| Comment | File | Size | Author |
|---|---|---|---|
| #23 | move-far.mp4 | 72.73 KB | ctrladel |
| #23 | general weirdness.mp4 | 218.29 KB | ctrladel |
| #23 | expanded-no-move.mp4 | 110.69 KB | ctrladel |
| #23 | end-with-slot.mp4 | 167.65 KB | ctrladel |
| #18 | chrome.gif | 1.33 MB | hooroomoo |
Issue fork experience_builder-3470594
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
changes, plain diff MR !275
- 3470594-layers
compare
Comments
Comment #2
hooroomooComment #3
wim leersThis seems related to #3470602: [PP-1] Consider using SortableJS spill plugin when dragging sections into layout?
Comment #4
hooroomooComment #5
hooroomooComment #6
wim leers#3458503: Improve the page hierarchy display is in!
Comment #7
hooroomooComment #10
hooroomooComment #11
hooroomooComment #12
hooroomooComment #13
lauriiiThe 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 😇
Comment #14
wim leers@hooroomoo: deprioritizing per #3454094-77: Milestone 0.1.0: Experience Builder Demo.
Comment #15
hooroomoo#13 The red/pink color to the clone was for debugging purposes 😅
Comment #16
wim leers#15: 🤣 I was hoping you'd say that 😆
Comment #17
hooroomooJotting notes down here
Still needs to be addressed
Comment #18
hooroomooIn 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...
Comment #20
hooroomooCrediting @balintbrews for finding the cause of the bug. Sortable ghost class styles was being overridden by hovered styles in TreeItem component.
Comment #21
wim leersFollow-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.
Comment #22
simohell commentedInitially 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.
Comment #23
ctrladelTried 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
Comment #24
jessebaker commentedIt would be interesting to know if you can set the
e.dataTransfer.setDragImageto 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!)
Comment #25
hooroomoo#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.
Comment #26
hooroomooComment #27
balintbrewsComment #29
balintbrews