Overview

When dragging in a new section, it's easy to accidently include it as part of the section above rather than it's own section.

Steps to replicate

  • Set up experience builder
  • Start dragging a new Hero section
  • See that when you are hovering over the bottom page, the interaction window of nesting in the above section vs making it's own section is quite small and not very clear.

Proposed resolution

Happy for options for this, potentially we could increase the size & change the colour of the striping that shows when you are dragging a component. It might help to make it more clear to the user where the new section will go. I've attached a screencast of an exaggerated version of what this could look like

User interface changes

Add a border around the parent slot that the component will be dragged into.
See the screencast in #15

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

DanielVeza created an issue. See original summary.

danielveza’s picture

Issue summary: View changes

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

gauravvvv’s picture

Status: Active » Needs review
StatusFileSize
new97.77 KB
new143.72 KB

Before

After

utkarsh_33’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Overall looks good to me.Now it makes the UX for dragging much cleaner.
Can you please update the issue summary and attach the screenshots for before and after in the User interface changes section?

lauriii’s picture

Issue summary: View changes
StatusFileSize
new12 KB

We could probably add further clarity by highlighting the slot where the component / section would be added.

This might be something to consider in a follow-up but I'm wondering if we could be opinionated about section templates and as a UX enhancement, only allow adding them to the main level. After the section has been added to the page, the user can drag the components to any shape they wish. Thoughts?

lauriii’s picture

Issue summary: View changes
StatusFileSize
new335.83 KB

I also realized that I'm not seeing this striping on my environment at all; instead I'm seeing a button with the name of the component 🤔

jessebaker’s picture

RE #8 Have you tried a cache clear since checking out this branch? I think that is what I did to resolve the same issue.

jessebaker’s picture

StatusFileSize
new1.46 MB

In Site Studio's Visual Page Builder the target slot (or Dropzone to use their terminology) is highlighted with a dotted border when you are dragging and hovering over the slot. I think we should have something similar.

lauriii’s picture

+1 for #10.

Clearing caches did resolve the issue from #8 👍

lauriii’s picture

I opened #3469895: Retain the space consumed by a component when it's being dragged which is a related issue. We don't need to solve for that here but it's probably good to keep that goal in mind.

jessebaker’s picture

RE #7

I'm wondering if we could be opinionated about section templates and as a UX enhancement, only allow adding them to the main level.

I don't think this would be beneficial for two reasons

1) If the issue is that it is difficult with the current UI to accurately place the thing you are drag/dropping into nested slots then we will still need to solve that problem for components so just preventing sections from working in that way would just be a sticky plaster
2) Ultimately I don't think we need to restrict users in that way - As an example, a given user's particular page layout may be based around having a large layout component that has a slot for all the page content and they would want to place their sections inside that larger component.

danielveza’s picture

StatusFileSize
new1.85 MB

I've added a POC of #10 to this MR. Still wrapping my head around how XB is built but it is working well.

I set it up as a seperate MR for the POC but if everyone is happy we could combine them. I've attached a screencast.

lauriii’s picture

Tested the MR from @DanielVeza manually and it seems like it's implements the border around slots from #7 which is a nice improvement. Thank you!! 🙏 We could open a follow-up issue to show the label of the slot.

lauriii’s picture

wim leers’s picture

FYI this is a de facto blocker to #3471085, because this likely would solve that bug report too, per @lauriii at #3471085-6: Adding a component with slots does not register the slots as children.

danielveza’s picture

Status: Needs work » Needs review
Issue tags: -Needs issue summary update

My MR is green, the phpcs being out of date will be resolved by #3471448: Update XB to match the latest Drupal 11 phpcs.xml.dist- 2024-09-01, I don't think that needs to block this from getting in.

The MR does not contain the changes that make the ghost area bigger, as I don't think thats required anymore with the border being applied

danielveza’s picture

Issue summary: View changes
wim leers’s picture

balintbrews’s picture

Title: Improve UX of adding new sections » Highlight slot with a border where component/section is about to be placed
Assigned: Unassigned » balintbrews
balintbrews’s picture

Title: Highlight slot with a border where component/section is about to be placed » [PP-1] Highlight slot with a border where component/section is about to be placed
Status: Needs review » Postponed

Let's land #3472121: Mitigate class pollution from injected CSS first and adjust the CSS class names accordingly.

wim leers’s picture

Title: [PP-1] Highlight slot with a border where component/section is about to be placed » Highlight slot with a border where component/section is about to be placed
Status: Postponed » Needs work

balintbrews’s picture

StatusFileSize
new7.12 MB

The MR is now ready for review. I adjusted the styling a bit to address a few things:

  1. Use an outline instead of a border so components are not moving due to the size of outline;
  2. Set a 100% height for the slots;
  3. Increase the height of the ghost element — the blue line showing where something will be placed — and add some horizontal space to play better with the slot outline visually;
  4. Introduce CSS variables to keep design tokens standardized.

XB slots being highlighted

balintbrews’s picture

Assigned: balintbrews » jessebaker
Status: Needs work » Needs review
kristen pol’s picture

Played around with this using some column components we created awhile ago. It seems to do what is intended (see video).

https://youtu.be/HtkEa8fp1kI

Components move out of the slots but that is due to this one I guess: #3471085: Adding a component with slots does not register the slots as children

balintbrews’s picture

Thanks for taking the time to test the changes, Kristen! And yes, that issue you linked to is going to address that problem very soon!

balintbrews’s picture

balintbrews’s picture

Just waiting for a final 👍🏻 from @jessebaker.

jessebaker’s picture

Assigned: jessebaker » Unassigned
Status: Needs review » Fixed

🎉 Merged!

kristen pol’s picture

Just tested with latest changes and it looks good, thanks!

Status: Fixed » Closed (fixed)

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