Closed FokkeZB closed 5 years ago
On second thought; I guess we can't rely on ResizeObserver
to always detect changes to the bounding rect as it per spec watches for changes to the content rect:
https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver
The ResizeObserver interface reports changes to the content rectangle of an Element or the bounding box of an SVGElement. The content rectangle is the box in which content can be placed, meaning the border box minus the padding.
Currently,
contentRect
is used, which doesn't include the element's padding and border.Changing this would be a breaking change, so perhaps we could mix in
rectWidth
,rectHeight
or even all of thegetBoundingClientRect
dimensions?See https://github.com/Swizec/useDimensions/blob/master/src/index.js#L3-L20