w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.47k stars 658 forks source link

[resize-observer] Why does ResizeObserver not fire on non-replaced inline elements? #6358

Open trusktr opened 3 years ago

trusktr commented 3 years ago

The resize-observer spec says

Observations do not fire for non-replaced inline Elements.

I am guessing this is because such elements are split into pieces (rows).

I see that the latest ResizeObserver spec allows it to return an array of sizes when content is split across columns. Based on this, it seems feasible to also have it give us an array of the sizes of the pieces of a non-replaced inline element's rows.

Or it could just give us the size of the bounding box, but this would make the use cases more limited, though the limited use cases could still be useful.

Is it simply that nothing has been decided on how to handle multiple pieces of a non-replaced inline element?

Loirooriol commented 1 year ago

getClientRects() has no problem returning the actual sizes of a non-atomic inline, so I think that ResizeObserver should just stop pretending that the size is zero and just populate the arrays with the fragment sizes.

It may be fine (or even required by compat) to keep contentRect being an empty rect or something special, but populating borderBoxSize, contentBoxSize and devicePixelContentBoxSize as normal seems useful.

rainxh11 commented 2 months ago

In a true W3C Fashion, a confusing API that only work 30% of the time IMO they should just scrap HTML & CSS altogether and start over with a proper rendering API and Markup language I've spent days trying to make something working in a WYSIWYG component and make it react to zoom & resize changes with no success a very stupid thing that takes me 5 minutes to accomplish in Flutter or Kotlin Jetpack or with any other Sane UI Rendering APIs