-
Notifications
You must be signed in to change notification settings - Fork 839
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
[EuiResizableContainer] Resizable container misbehaves when using react-reverse-portal #6199
Comments
Hey @davismcphee I could be misunderstanding, but I'm not sure it has to do with |
@thompsongl Thanks for the quick response! It looks like the issue you linked relates to what happens when the cursor is moved outside of the EuiResizableContainer while resizing. The issue I'm experiencing is that when using react-reverse-portal the resize is cancelled when the cursor moves outside of the EuiResizableButton even though it's still within the EuiResizableContainer. Since the button follows the cursor when resizing, moving slowly keeps the cursor above the button and things work as intended. But if you move the cursor slightly faster, the button will naturally lag a bit and the cursor will move from over top it to above the panels. This is when the resizing seems to be cancelled. |
@thompsongl Looking into this further, it seems this is related to event delegation in React and is a known issue with Considering how niche this use case is, I wouldn't expect EUI to implement a similar workaround to support it, but I was wondering if it would make sense for If this is something the EUI team would be open to, I'll close this issue and open a new one requesting the callbacks instead. |
Ah yes I like that idea!
This is an interesting idea re: #4931. Augment the UI broaden the drag area. |
Great! I've created an issue for the callbacks instead (#6225), so I'll close this one now.
Yup I think this approach would likely work for the charts use case from the issue, and something similar might be possible for extending the drag area by using an overlay with fixed positioning. I'm not sure how this would affect the event listeners though. For reference, this component includes our current workaround: https://github.com/elastic/kibana/blob/75a660174a2bee9b32ef81521331aebe0c83491a/src/plugins/discover/public/application/main/components/layout/discover_panels_resizable.tsx |
We're using EuiResizableContainer as part of a project to make the histogram in Discover resizable (elastic/kibana#139446). In some cases the resizable layout is swapped out with a fixed layout such as when viewing on small screens or when hiding the histogram. Typically when this happens React has to remount the child components since their parents have changed, but this causes rendering delays as the child components are pretty heavy to remount. To keep the children from remounting when the layout is swapped, we're using the react-reverse-portal library (https://github.com/httptoolkit/react-reverse-portal).
This works as intended except that EuiResizableContainer conflicts with react-reverse-portal. It seems that resizing stops working whenever the mouse leaves the resize button element while dragging:
I've created a branch in my EUI fork demonstrating the issue on the EuiResizableContainer docs page: https://github.com/davismcphee/eui/tree/resizable-reverse-portals.
The text was updated successfully, but these errors were encountered: