superset icon indicating copy to clipboard operation
superset copied to clipboard

fix(dashboard): drag and drop indicator UX

Open justinpark opened this issue 1 year ago • 10 comments

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
drop-indicator-bug

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
drop-indicator-after

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

justinpark avatar Jan 19 '24 23:01 justinpark

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%.

Files Patch % Lines
...nd/src/dashboard/components/gridComponents/Row.jsx 53.84% 8 Missing and 4 partials :warning:
...rontend/src/dashboard/components/dnd/handleDrop.js 0.00% 5 Missing :warning:
...src/dashboard/components/gridComponents/Column.jsx 80.00% 0 Missing and 2 partials :warning:
...rontend/src/dashboard/components/DashboardGrid.jsx 83.33% 0 Missing and 1 partial :warning:
...end/src/dashboard/components/dnd/DragDroppable.jsx 66.66% 0 Missing and 1 partial :warning:
...nd/src/dashboard/components/gridComponents/Tab.jsx 80.00% 0 Missing and 1 partial :warning:
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.

codecov[bot] avatar Jan 20 '24 00:01 codecov[bot]

/testenv up

justinpark avatar Jan 20 '24 03:01 justinpark

@justinpark Ephemeral environment creation is currently limited to committers.

github-actions[bot] avatar Jan 20 '24 03:01 github-actions[bot]

/testenv up

michael-s-molina avatar Jan 22 '24 13:01 michael-s-molina

@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.

github-actions[bot] avatar Jan 22 '24 13:01 github-actions[bot]

@sadpandajoe

michael-s-molina avatar Jan 22 '24 13:01 michael-s-molina

@justinpark this looks and feels so much better! definitely a much needed improvement :)

A few things I noticed:

  1. When adding tabs to a dashboard, the drop area extends a bit too far, into the right panel image
  2. When adding a chart element, the dashboard header row is also highlighted as a possible drop area
  3. 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 :( image

yousoph avatar Jan 31 '24 00:01 yousoph

@justinpark this looks and feels so much better! definitely a much needed improvement :)

A few things I noticed:

  1. When adding tabs to a dashboard, the drop area extends a bit too far, into the right panel image
  2. When adding a chart element, the dashboard header row is also highlighted as a possible drop area
  3. 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 :(
image

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?

image

kasiazjc avatar Jan 31 '24 12:01 kasiazjc

@yousoph Sorry for the late response. Here are my answers.

  1. 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.

Screenshot_2024-02-07_at_4_05_40 PM

  1. 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.

chart_disabled_area

  1. 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.

justinpark avatar Feb 08 '24 00:02 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.

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.

justinpark avatar Feb 08 '24 00:02 justinpark

@kasiazjc @yousoph, barring any further objections from your end, I intend to proceed to the next step.

justinpark avatar Feb 15 '24 17:02 justinpark

@michael-s-molina could you help this code review?

justinpark avatar Feb 21 '24 00:02 justinpark

Ephemeral environment shutdown and build artifacts deleted.

github-actions[bot] avatar Feb 21 '24 19:02 github-actions[bot]