when return value of the getElementRects
is a DOMRect, only the x
, y
fields exist in rect in convertOffsetParent34
method
#2795
Labels
Describe the bug A clear and concise description of what the bug is.
width
,height
get properties of rect are loss when using object spreading from DOMRect instanceI'm working with floating-ui/core to connect canvas(reference) and div(floating).
When I implemented the platform's required method
getElementRects
, I gave the floating field like below.I had an issue when I added the
shift
middleware.I tracked down the issue and found that the argument rect of the
convertOffsetParentRelativeRectToViewportRelativeRect
function was{x, y}
width
,height
did not exist (not evenundefined
ornull
)To Reproduce
Steps to reproduce the behavior:
Platform.getElementRects
shift
middlewareExpected behavior A clear and concise description of what you expected to
happen.
Rect argument of
Platform.convertOffsetParentRelativeRectToViewportRelativeRect
method has{x, y, width, height }
Screenshots If applicable, add screenshots to help explain your problem.
Context:
Additional context Add any other context about the problem here.
The bug was gone, when I changed
getElementRects
code like below.Copying values via object spreading within the core library seems to be broken for DOMRect.
Currently, type checking in typescript doesn't seem to catch this behavior.
It seems like a good idea to mention this in places like the platform documentation, or to reduce spreading techniques in core library code.
My Company development work relies heavily on floating-ui package. I appreciate your work so far.
The text was updated successfully, but these errors were encountered: