units icon indicating copy to clipboard operation
units copied to clipboard

Conversion to % does not work with position: fixed elements

Open t10ko opened this issue 3 years ago • 0 comments

When you try to convert from PX to % on an element, which is a child of body and has fixed position, it will throw an error on utilities.getRelativeElementDimension, when trying to get element.offsetParent, which is null in that case.

The solution I propose is to add document.documentElement fallback to offsetParent: reference = positioned ? element.offsetParent || document.documentElement : element.parentNode;

t10ko avatar May 23 '21 11:05 t10ko