Closed
Description
In the code the onCollapse function is called only when the following condition is satisfied:
if (baseHeight.value === getComputedHeight(collapseRef)) {
onCollapsed()
}
However the computed height of the element is not always exact.
For instance I have an element that is 42px
in height. When running in chrome, when user zooms the page out to 90% the computed height value is no longer 42px
but 41.9965px
. So this condition fails, and the state of the collapsible is never updated.
This is a subpixel rendering issue that caused it, so I think a proper solution would be to trim/round the computed value. I don't think a sub-pixel precision is required and it would fix this issue.
On an unrelated note: floating point numbers shouldn't be compared using equality operator.