react-split-pane
react-split-pane copied to clipboard
Weird behavior while resizing when one of the panes is an iframe
Describe the bug
Weird behavior while resizing when one of the panes is an iframe
To Reproduce
Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/upbeat-morning-94qr7
- Try to resize panes
Expected behavior
Should be able to resize as usual
Additional context
Try rendering anything other than an iframe. I think the problem here is Mouse events are not being captured by the window in which SplitPane is defined. Instead, iframe itself is capturing the mouse event.
Possible solution
- When SplitPane is resizing a wrapper with 100% height and 100% width can be created on top of the panes. Doing this will prevent iframe from capting mouse events.
- Instead of doing this each time some prop e.g.
disablePointer
can be exposed. Which ensures that a wrapper is created on top of both the panes
I created a relatively simple fix that keys off the "active" state of the pane
https://github.com/quarkw/react-split-pane/commit/bd1f68ac9ee89a09b7086fbb70065a9457ae44f0
Added 'opacity: 0' to the overlay in case the user has custom styling on div's. It may help a bit with performance too, since the browser doesn't have to render anything (but still needs to track mouse events)
https://github.com/quarkw/react-split-pane/commit/96dc6a0d666e663a9d96355a75162d59cf4a696e
Any solution for this issue ??
This is a duplicate of https://github.com/tomkp/react-split-pane/issues/30. The other issue also contains a proposal for a workaround.
I tried the work around but it's not helpful.