Comment

Comment by Aejkatappaja

Thanks! Right now it relies entirely on getBoundingClientRect(), so if an element has no dimensions yet the block gets skipped.

For images/videos I added a load event listener that re-measures once the media loads and takes up space.

For elements that are truly dynamic with no initial size, the best workaround today is setting explicit dimensions via CSS (min-height, aspect-ratio, etc.) which is good practice for CLS anyway.

That said, something like data-shimmer-width / data-shimmer-height attributes to manually override sizing could work well for that use case.

Adding it to the backlog!

parent Aejkatappaja 7 months ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton