If the helper is added to the container instead of the body, its relative styles will still be applied.
There are a number of reasons for this, but long story short, it causes a lot more headaches than it solves. The challenges that arise when you try to append the element to the container instead of the body greatly outweigh the small benefits you get. Inevitably you end up needing a wrapper div to solve some of these challenges, which wouldn't make this component a HOC anymore. Feel free to try it for yourself :)
Also:
overflow: scroll or overflow:hidden.react-virtualized or react-infinte list, nevermind the fact that touch events stop firing when the e.target gets removed from the DOM.If you're using css-modules (if not, you should really give it a shot), this isn't really an issue either.
I see, thank you for this explanation.
None of these points answer, why a custom container couldn't be provided as an optional prop
Most helpful comment
None of these points answer, why a custom container couldn't be provided as an optional prop