You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[EuiDragDrop][EuiPopover] Draggable is way out of the context when start dragging in popover #6314
@nlatipov Can you please include an animated screencap of the "way out of context" behavior you're seeing? I'm not seeing that as described on the linked CodeSandbox with latest Firefox:
Yes, there's a brief second where the draggable items are 5-10px or so off to the left but that's neither breaking nor an issue we would currently consider high priority.
Hey y'all, after more digging I've discovered the issue.
First things first, you always need to set transform: none !important; on any popover panels that contain drag & drop. This is because drag & drop does not work inside transformed elements. There is an example of our own EuiDataGrid using this workaround here:
// Hack because the fixed positions of drag and drop don't work inside of transformed elements
// sass-lint:disable-block no-important
transform: none!important;
transition: none!important;
margin-top: -$euiSizeS;
}
When EuiPopover was converted to Emotion, it started to use filter to create a drop shadow effect instead of box-shadow (I assume for modern CSS reasons/performance), causing our EuiDataGrid popover drag & drop to stop working.
Unfortunately filter appears to create a stacking context that causes drag & drop to misbehave 💀 Since EuiPopover requires none workarounds (see 1.) in the first place to get drag context working, I'm leaning towards leaving the current CSS as-is and instead documenting the need to restore box-shadow manually.
import{css}from'@emotion/react';import{useEuiTheme,euiShadowMedium}from'@elastic/eui';exportconstYourComponent=()=>{consteuiTheme=useEuiTheme();constpanelCss=css`transform: none !important;transition: none !important; // Recreate the drop-shadow filter via box-shadow insteadfilter: none !important;${euiShadowMedium(euiTheme)} // @include euiBottomShadow if using Sass `;return(<EuiPopoverpanelProps={{css: panelCss}}>
// Popover contents
</EuiPopover>);}
I realize that's not great and I'm debating adding some sort of helper or mixin within EUI to assist with not having to create your own overrides, or potentially a simpler hasDragDrop prop to EuiPopover itself. That will take a while to release/reach Kibana however, so in the interim the above CSS will unblock you until that gets in.
Reacted by Chandler Prall, Nodir Latipov and Andrea Del Rio
Activity
cee-chen commentedon Oct 24, 2022
@nlatipov Can you please include an animated screencap of the "way out of context" behavior you're seeing? I'm not seeing that as described on the linked CodeSandbox with latest Firefox:
Yes, there's a brief second where the draggable items are 5-10px or so off to the left but that's neither breaking nor an issue we would currently consider high priority.
nlatipov commentedon Oct 25, 2022
@constancecchen made a new demo. added another div above the popover. Now the deviation is more visible.
Screen.Recording.2022-10-25.at.08.53.15.mov
Ultimately, this bug leads to the fact that when trying to implement a new feature, we see unexpected behavior in the drag and drop
Screen.Recording.2022-10-20.at.16.44.28.mov
alexwizp commentedon Oct 25, 2022
@constancecchen please have a look that and give us some recommendation what we can do with it. It's a blocker for us
cee-chen commentedon Oct 25, 2022
Y'all are totally right, apologies. This is actually affecting our own drag & drop of items in our EuiDataGrid toolbar popovers as well in production (https://eui.elastic.co/v62.0.1/#/tabular-content/data-grid). I'm digging into this now but this bug appears to have started in v62.0.0, when EuiPopover was converted to Emotion.
CC @chandlerprall for info, as I just added the urgent label to this
cee-chen commentedon Oct 25, 2022
Hey y'all, after more digging I've discovered the issue.
First things first, you always need to set
transform: none !important;on any popover panels that contain drag & drop. This is because drag & drop does not work inside transformed elements. There is an example of our own EuiDataGrid using this workaround here:eui/src/components/datagrid/controls/_data_grid_toolbar.scss
Lines 55 to 61 in 7412e4f
When
EuiPopoverwas converted to Emotion, it started to usefilterto create a drop shadow effect instead ofbox-shadow(I assume for modern CSS reasons/performance), causing our EuiDataGrid popover drag & drop to stop working.Unfortunately
filterappears to create a stacking context that causes drag & drop to misbehave 💀 Since EuiPopover requiresnoneworkarounds (see 1.) in the first place to get drag context working, I'm leaning towards leaving the current CSS as-is and instead documenting the need to restorebox-shadowmanually.Putting that all together: here's what you need to get drag & drop inside popovers working: https://codesandbox.io/s/relaxed-elion-gkd0h7?file=/demo.js:1226-1664
I realize that's not great and I'm debating adding some sort of helper or mixin within EUI to assist with not having to create your own overrides, or potentially a simpler
hasDragDropprop to EuiPopover itself. That will take a while to release/reach Kibana however, so in the interim the above CSS will unblock you until that gets in.nlatipov commentedon Oct 25, 2022
Thanks for resolving this issue so quickly. I looked it up in a demo project. And it seems to solve our problem. Tomorrow I will show the team.
I hope the fix will be moved to the EUI soon and we will be able to clean up the kibana from this code
Thanks guys
cee-chen commentedon Oct 27, 2022
Anytime, I really appreciate the time y'all took to get a clear CodeSandbox to us!
I've created a PR with a new
hasDragDropprop for EuiPopover (#6329). As a heads up it will likely take another 2-3+ weeks to get into Kibana.