fix(dashboard): drag and drop indicator UX
SUMMARY
Following up #26313 This commit addresses and resolves the issue of an unclear drop zone indicator that was negatively impacting the user experience in the dashboard editor.
When a component was being dragged towards the edge of the tab container or the row/column containers, multiple drop indicators were often displayed. This created confusion about the exact insertion point of the element. [fig. 1]
| fig. 1 |
|---|
The root of the problem was that these dashboard components were wrapped by both draggable and droppable interfaces, which led to overlapping and conflicting drop zones. This commit modifies this by making the dashboard components draggable only, and builds a distinct, non-conflicting area for the drop zone. Moreover, it also highlights the drop zone during the dragging process to clearly indicate where the element will be placed. [fig. 2]
| fig. 2 |
|---|
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
https://github.com/apache/superset/assets/1392866/315309e9-a8ad-45c4-a292-190a318c8d67
After:
https://github.com/apache/superset/assets/1392866/2342eee1-418d-4c35-9a21-f5772136c0ec
TESTING INSTRUCTIONS
Go to dashboard and edit mode Drag and drag multiple components and then save Verify the dashboard shown as designed
ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in SIP-59)
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
Codecov Report
Attention: 22 lines in your changes are missing coverage. Please review.
Comparison is base (
daaf657) 67.19% compared to head (e4fdc64) 67.20%.
Additional details and impacted files
@@ Coverage Diff @@
## master #26699 +/- ##
==========================================
+ Coverage 67.19% 67.20% +0.01%
==========================================
Files 1899 1899
Lines 74369 74398 +29
Branches 8274 8287 +13
==========================================
+ Hits 49971 50000 +29
- Misses 22343 22349 +6
+ Partials 2055 2049 -6
| Flag | Coverage Δ | |
|---|---|---|
| javascript | 56.94% <67.16%> (+0.03%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
/testenv up
@justinpark Ephemeral environment creation is currently limited to committers.
/testenv up
@michael-s-molina Ephemeral environment spinning up at http://18.236.117.76:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.
@sadpandajoe
@justinpark this looks and feels so much better! definitely a much needed improvement :)
A few things I noticed:
- When adding tabs to a dashboard, the drop area extends a bit too far, into the right panel
- When adding a chart element, the dashboard header row is also highlighted as a possible drop area
- I managed to get an error when dragging a chart in between the header and the dashboard area somewhere, but I can't figure out how to repro it :(
@justinpark this looks and feels so much better! definitely a much needed improvement :)
A few things I noticed:
- When adding tabs to a dashboard, the drop area extends a bit too far, into the right panel
- When adding a chart element, the dashboard header row is also highlighted as a possible drop area
- I managed to get an error when dragging a chart in between the header and the dashboard area somewhere, but I can't figure out how to repro it :(
![]()
agree with Sophie on all of the above!
Definitely an improvement to the dnd, thank you @justinpark ☺️
one comment about the header thing Sophie mentioned: when you try to hover over it it shows a red box (error), which gave me an idea. I think maybe it could be used in places where there is not enough space to place the item, for example if the row is full. What do you think?
@yousoph Sorry for the late response. Here are my answers.
- When adding tabs to a dashboard, the drop area extends a bit too far, into the right panel
Given that the tab (in the header) will occupy the whole row, including the right panel as shown in the following screenshot, it seems more logical for this highlight area to indicate its transition into a global header layout.
- When adding a chart element, the dashboard header row is also highlighted as a possible drop area
As discussed during our plans for further D&D improvements, I've earmarked this particular enhancement for @rtexelm's project. In the interim, this version will highlight in red (instead of the primary color) when you hover over the drop area, as shown in the following screenshot.
- I managed to get an error when dragging a chart in between the header and the dashboard area somewhere, but I can't figure out how to repro it :(
I tried to reproduce the same problem but cannot get the issue yet. please let me know if you find the problem again.
one comment about the header thing Sophie mentioned: when you try to hover over it it shows a red box (error), which gave me an idea. I think maybe it could be used in places where there is not enough space to place the item, for example if the row is full.
I had a similar thought as well, but there are complexities when it comes to dropping an existing component into a space that's just enough. Specifically, it's challenging to programmatically differentiate this from the prohibited drop zones.
(For instance, the highlight box should not turn red when item [1] is dropped into a zone without space, as it's possible to reorder among the same row items. However, it should turn red when item [4] is dropped into a zone without space.)
|[ 1 ]|[ 2 ]|[ 3 ][no space drop zone]|
--------
|[ 4 ]|[ ]|
Therefore, I've decided to retain the post notification as it is currently displayed.
@kasiazjc @yousoph, barring any further objections from your end, I intend to proceed to the next step.
@michael-s-molina could you help this code review?
Ephemeral environment shutdown and build artifacts deleted.
