[csswg-drafts] [resize-observer] What should the fragment-aware behavior be when there are no fragments? (#7734)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [resize-observer] What should the fragment-aware behavior be when there are no fragments? ==
See https://github.com/w3c/csswg-drafts/issues/3673#issuecomment-467221565

> RES0LVED: Option 1; contentBox is an array of fragment sizes

So if a box has 1 fragment then the array has length 1, if it has 2 fragments it has length 2, and so on.

What if the element has no fragments like in `display: none`? Then getting an empty array would probably make the most sense.

Likewise for non-atomic inlines, which are considered to have a size of zero. Since this is not a real size it might make more sense to represent it as a lack of fragments.

I think it's also possible (e.g. with [`continue: discard`](https://drafts.csswg.org/css-overflow-4/#valdef-continue-discard)) to have an element that generates a box, but no fragment is created.

The risk of an empty array is that right now with the non-fragment aware API we get an array of length 1 (a 0x0 size). I'm concerned that several web pages may be using `contentBoxSize[0].inlineSize` without checking `contentBoxSize.length`. See https://github.com/envato/react-breakpoints/blob/5b25ede569801efa0030e42e49b9fca08308dc47/src/useBreakpoints.ts#L99-L120 for an example.

That said, elements with a size of 0x0 (either real or due to no box or inline box) weren't initially getting their ResizeObserver callback invoked before #3664, so it may not be a big deal if the callback now throws in the non-real 0x0 case.





Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7734 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 13 September 2022 17:50:22 UTC