Re: [csswg-drafts] [cssom-view] `getClientRects()` should return a flattened list of child rects for `display: contents` (#12040)

I don't think I agree with the proposal.

First, an element with `display: contents` generates no box of its own, so `getClientRects()` being empty seems reasonable to me.

Then, if `getClientRects()` redirects to children, it can create a disparity with other APIs. Should `ResizeObserver` also return/track the list of sizes of the children? `clientWidth`? Etc.

Also, what children would be reported, exactly?
 - Text nodes have no `getClientRects()`, are they included?
 - Pseudo-elements have no `getClientRects()`, are they included? Which ones?
 - Would this choose children in the flat tree? Even if that would expose number of contents of a closed shadow root?

It just seems an inconsistent can of worms to me. I think it's better to defer this to authors if they want to do something special if `getComputedStyle(el).display === "contents"`. 



-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12040#issuecomment-3105579900 using your GitHub account


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

Received on Wednesday, 23 July 2025 03:52:37 UTC