feat(cdkDrag): Specify drag clone location #20536
Labels
area: cdk/drag-drop
feature
This issue represents a new feature or feature request rather than a bug or bug fix
Feature Description
When dragging an element using cdkDrag, a clone is appended to body see here
Whilst end of body is a sensible default location, it'd be great if this were configurable to a DOM Element or ElementRef.
Use Case
We have an Angular component library which is built against a "global" CSS package.
Each selector in the global CSS package is selector scoped against a data attribute describing which brand is belongs to, such as
[data-theme="blue"] .button
This enables a single microfrontend to be easily theme switched based on user / channel context.
Our
<body>
looks something akin to:When using the Drag and Drop module, the clone is created outside either of the scoped themes so therefore the clone is unstyled so you get something like this:
Whilst this problem doesn't happen when using style encapsulated components, we're unable to achieve the desired multi-theming thanks to having to support IE11 and it's lack of support for custom properties.
The only solution I can think of is similar to the CDK Portal, being able to control where it embeds.
The text was updated successfully, but these errors were encountered: