-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move to portal solution for Draggables #192
Comments
For context:
Now that react has a supported portal feature we could look into doing it. I am keen to avoid any regressions on the consumption experience which is currently really nice. We will probably not look at this for a while as we have a large number of higher priority features we want to ship. In the mean time you might find this issue helpful: #128 specifically the part about overriding top/left values rather than using the transform. |
Thank, I was aware of your constraints. I will look into it. |
I managed to get this to work with Portal from react-dom without changing styles etc. I added a dom element into my html
Added the following styles
And then added this to the Draggable
Hope this helps :) |
Thanks @kasperpihl. I have created a reusable example for people to play with which also works for keyboard dragging: https://www.webpackbin.com/bins/-L-3aZ_bTMiGPl8bqlRB Keep in mind that this is not a supported pattern and we are not testing against it. Early next year this will be done by default and as a consumer you will not need to worry about it |
I have added a note in the docs about this: https://github.com/atlassian/react-beautiful-dnd#warning-position-fixed |
Note to future self:
|
The createPortal, is client feature. I think this solution unfortunately isn't compatible with SSR. |
The portal is only used while dragging. So SSR will be unaffected |
Uhm... with some I don't no if this information will help you in any way, but the new Portal implementation for Material-ui V1, is very fine. Maybe you wanna take a look. If the |
Creating element in portal will drop element in component and another element jumping
|
@alexreardon Your example link is broken. https://www.webpackbin.com/bins/-L-3aZ_bTMiGPl8bqlRB |
This one is troubling me. There are a few draw backs to moving to portals:
This is understandable that the portal adds this time given that the old component tree is being unmounted and remounted into a new location. However, for our purposes this is a significant performance regression. The ideal would be for the portal not to reprocess the tree and simply shift it to the new node.. I am not sure how to proceed. Portals are really important for style purposes, but this perf hit is hard to swallow. I was thinking of turning on portals by default and letting users opt out for high performance needs. However, given that there are fairly significant performance regressions I am not sure whether we should move to portals at this stage.. |
So I’m using the framework with portals at the moment and it was not a big deal to set up, once figured out. I vote you don’t use portals in the framework, but show a simple example how you can set that up yourself and make people aware about the performance loss. I really love your focus on performance. |
@alexreardon is vanilla JS an options? |
@onemenny might be possible I think. react-helmet is doing that. |
For now we will not add portal support into react-beautiful-dnd itself. So we will not be adding a prop to turn on/off the usage of We are still thinking about whether we should guarantee |
https://webpackbin-prod.firebaseapp.com/bins/-L-3aZ_bTMiGPl8bqlRB |
We now support consumers using their own portals see using a portal guide |
This link is broken |
But the example by kasperpihl seems to work fine, and is easy to setup |
Bug or feature request?
Feature request
Well, it is lame, as mentioned in the ReadMe. I had to deal with transitionend event, plus add many patches to get it semi working. I do believe that transitions have become a standard with animations and more. Having a transitioned panel as a parent of beautiful-dnd is not far fetched, as I had to deal with it. Append to body option is something many 3rd party component adds to give a 360 degree compliance
I for one, would certainly like to see this feature added
Any way, thank you for the hard work.
The text was updated successfully, but these errors were encountered: