marcj / css-element-queries

CSS Element-Queries aka Container Queries. High-speed element dimension/media queries in valid css.
http://marcj.github.io/css-element-queries/
MIT License
4.27k stars 487 forks source link

ResizeSensor should not change element position #196

Closed movedoa closed 6 years ago

movedoa commented 6 years ago

OffsetParent is not reliable to check if an element is positioned or not. For example offsetparent is null if the element or any of its parents is display:null. But when the element is shown later on, the resizesensor would still work as expected without changing anything.

I would rather have a non working resizeSensor than a broken layout. There should either be just be a warning (in the console?) or a setting if resizesensor is allowed to modify the style. (or a perfect check ;-) )

marcj commented 6 years ago

Well, this is part of the fix for https://github.com/marcj/css-element-queries/issues/46. Where we execute the init code (set position on actual element and reset its sensors) when the element becomes visible.

marcj commented 6 years ago

Fixed, will be part of the next version.