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
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | xb-slot-outline.gif | 7.12 MB | balintbrews |
| #15 | Screencast from 2024-08-28 12-26-13.mp4 | 1.85 MB | danielveza |
| #10 | 2024-08-23 11.12.54.gif | 1.46 MB | jessebaker |
| #8 | CleanShot 2024-08-23 at 11.07.39.gif | 335.83 KB | lauriii |
| #7 | Screenshot 2024-08-23 at 10.50.36 AM.png | 12 KB | lauriii |
Issue fork experience_builder-3469822
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
Comment #2
danielvezaComment #5
gauravvvv commentedBefore

After

Comment #6
utkarsh_33 commentedOverall 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
beforeandafterin the User interface changes section?Comment #7
lauriiiWe 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?
Comment #8
lauriiiI 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 🤔
Comment #9
jessebaker commentedRE #8 Have you tried a cache clear since checking out this branch? I think that is what I did to resolve the same issue.
Comment #10
jessebaker commentedIn 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.
Comment #11
lauriii+1 for #10.
Clearing caches did resolve the issue from #8 👍
Comment #12
lauriiiI 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.
Comment #13
jessebaker commentedRE #7
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.
Comment #15
danielvezaI'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.
Comment #16
lauriiiTested 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.
Comment #17
lauriiiOpened #3470973: Retain the placement of components within the preview when inserting a component which would help further improve this.
Comment #18
wim leersFYI 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.
Comment #19
danielvezaMy 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
Comment #20
danielvezaComment #21
wim leers#3470973: Retain the placement of components within the preview when inserting a component landed, let's land this next? 😄
Comment #22
balintbrewsComment #23
balintbrewsLet's land #3472121: Mitigate class pollution from injected CSS first and adjust the CSS class names accordingly.
Comment #24
wim leers#3472121: Mitigate class pollution from injected CSS is in.
Comment #26
balintbrewsThe MR is now ready for review. I adjusted the styling a bit to address a few things:
Comment #27
balintbrewsComment #28
kristen polPlayed 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
Comment #29
balintbrewsThanks for taking the time to test the changes, Kristen! And yes, that issue you linked to is going to address that problem very soon!
Comment #30
balintbrewsComment #31
balintbrewsJust waiting for a final 👍🏻 from @jessebaker.
Comment #33
jessebaker commented🎉 Merged!
Comment #34
kristen polJust tested with latest changes and it looks good, thanks!