digidem / react-dimensions

[Looking for maintainers]

Home Page:http://lab.digital-democracy.org/react-dimensions/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

using dimensions on components that get moved to popout windows has wrong window reference

DimitarChristoff opened this issue · comments

simple usecase

using react-popout (https://github.com/JakeGinnivan/react-popout) to tear off components into popout windows, which basically unmounts it and then re-mounts it into a new window and a new document.

the problem is this code: https://github.com/digidem/react-dimensions/blob/master/index.jsx#L110

window.addEventListener('resize', this.onResize, false)

... may resolve the window object too early and to the parent (original window), therefore adding the event to the wrong one.

subsequent resizes of the popout window do not trigger the resize and dimensions do not update but if the popout.opener gets resized, it fixes the popout dimensions.