Re: [csswg-drafts] [cssom-view-1] offsetParent spec says that we return elements from open shadow trees, no browser does. (#12392)

The CSS Working Group just discussed `[cssom-view-1] offsetParent spec says that we return elements from open shadow trees, no browser does.`, and agreed to the following:

* `RESOLVED: Make offsetParent spec match reality`
* `ACTION: flackr to open issue on making scrollParent a function`
* `ACTION: dbaron to open an issue on replacements for offsetParent`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> scribe+<br>
&lt;lea> q?<br>
&lt;emilio> flackr: As I was implementing scrollParent I discovered that the spec for offsetParent claims we should expose elements within open shadow trees yet no impl does that<br>
&lt;lea> q+<br>
&lt;emilio> ... I'd like to resolve to change it to match implementations and do the same for scrollParent<br>
&lt;emilio> q+<br>
&lt;astearns> ack lea<br>
&lt;emilio> lea: is there a reason for what browsers do?<br>
&lt;lea> q+<br>
&lt;fantasai> emilio: implementation-wise it's the same, but I don't think any DOM API distinguishes between both<br>
&lt;fantasai> emilio: DOM event targetting etc. works the same in open vs closed shadow root<br>
&lt;masonf> +1<br>
&lt;fantasai> emilio: So I think it's best to not differentiate here either<br>
&lt;fantasai> emilio: for APIs where you might want to get things from shadow roots, we've added option to pass shadow roots to have access to<br>
&lt;fantasai> emilio: that way you can access both closed and open shadow roots depending on what you have access to<br>
&lt;emilio> lea: what do they actually return?<br>
&lt;astearns> ack lea<br>
&lt;emilio> ... do they return the host or do they skip that element?<br>
&lt;emilio> flackr: they skip to the shadow host but it might traverse further up if the shadow host doesn't meet the requirements<br>
&lt;emilio> lea: the current behavior seems more useful<br>
&lt;emilio> ... wondering if we could also add a corresponding property that does the right thing<br>
&lt;emilio> q+<br>
&lt;oriol> q+<br>
&lt;astearns> ack emilio<br>
&lt;astearns> ack oriol<br>
&lt;fantasai> emilio: Could add an argument to do it consistently in the DOM, but I don't think it should be specific to offsetParent APIs<br>
&lt;flackr> +1<br>
&lt;lea> s/lea: the current behavior seems more useful/lea: the current behavior seems more useful, but I also understand the web compat argument of speccing what browsers already do/<br>
&lt;emilio> oriol: I think scrollParent should be a function to allow eventual extensions?<br>
&lt;astearns> ack dbaron<br>
&lt;lea> +1 oriol<br>
&lt;emilio> dbaron: I think we should be looking at offset* as a legacy API<br>
&lt;emilio> ... I think the implementation of these existed well before the spec did<br>
&lt;emilio> ... in general we want to bias towards specifying what's implemented<br>
&lt;emilio> ... to some degree we have various APIs that are trying to replace them<br>
&lt;emilio> ... some of that is implemented like getBoundingClientRect and other pieces in the geometry spec?<br>
&lt;masonf> examples: innerHTML --> getHTML(),   getRangeAt() --> getComposedRanges(), etc.<br>
&lt;emilio> ... not sure what the state of all of them are?<br>
&lt;lea> q?<br>
&lt;lea> q+<br>
&lt;emilio> ... I would not try and improve offset*<br>
&lt;emilio> ... I'd try and build the API we want more generally<br>
&lt;astearns> ack lea<br>
&lt;emilio> q+<br>
&lt;emilio> lea: I agree these are weird and fine to treat them as legacy<br>
&lt;emilio> ... but not sure what'd be the replacement<br>
&lt;emilio> ... is there an API that could replace them today?<br>
&lt;astearns> ack emilio<br>
&lt;fantasai> emilio: [missed]<br>
&lt;fantasai> emilio: The consistent thing to do is to not distinguish between open and closed shadow roots<br>
&lt;lea> many scripts were written before shadows were a thing and use these properties for positioning and ideally should not break too badly when dropped into a page that has shadow roots<br>
&lt;masonf> q+<br>
&lt;fantasai> emilio: We can decide to use a function for scoped parent or add a new function for passing list of shadow roots or whatever<br>
&lt;astearns> s/[missed]/yes these things were implemented before being specced, but shadow root came after the spec<br>
&lt;fantasai> emilio: but big +1 to spec what's implemented for offsetParent because it's the right thing to do<br>
&lt;astearns> ack masonf<br>
&lt;Kurt> +1 emilio<br>
&lt;fantasai> emilio: consistent with the way it works elsewhere in DOM<br>
&lt;lea> q?<br>
&lt;lea> q+<br>
&lt;emilio> masonf: I commented with some precedent on the DOM side (innerHTML / getHTML() / etc)<br>
&lt;astearns> ack lea<br>
&lt;emilio> ... not a technical issue, just a consistency argument<br>
&lt;emilio> lea: Fine to spec what's implemented, but we should work to close the gap because there's no way of doing what the spec says<br>
&lt;emilio> dbaron: yeah it'd be good to have some element-to-element coord space conversion<br>
&lt;emilio> PROPOSED: Fix offsetParent by spec-ing reality, but work into a way to opt into looking into shadow roots<br>
&lt;emilio> q+<br>
&lt;kbabbitt> +1<br>
&lt;lea> (though hopefully anchor positioning renders many of the use cases for these properties obsolete)<br>
&lt;masonf> +1<br>
&lt;lea> +1<br>
&lt;astearns> ack emilio<br>
&lt;fantasai> emilio: We should definitely update offsetParent.<br>
&lt;oriol> It's implemented in Blink and Servo<br>
&lt;fantasai> emilio: scrollParent is not implemented anywhere, so maybe we can make it functional already<br>
&lt;fantasai> flackr: We have an implementation, but not shipped yet<br>
&lt;fantasai> emilio: fair<br>
&lt;emilio> RESOLVED: Make offsetParent spec match reality<br>
&lt;dbaron> I think some of what I'm thinking of was for a time in a GeometryUtils interface in https://drafts.fxtf.org/geometry/#geometryutils<br>
&lt;emilio> astearns: if we make scrollParent a function we can allow passing a list of shadow roots<br>
&lt;emilio> flackr: I see<br>
&lt;emilio> astearns: we should file an issue for that<br>
&lt;fantasai> ACTION: flackr to open issue on making scrollParent a function<br>
&lt;emilio> astearns: we should look into whether appropriate replacements for offsetParent exist<br>
&lt;fantasai> ACTION: dbaron to open an issue on replacements for offsetParent<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12392#issuecomment-3382322405 using your GitHub account


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

Received on Wednesday, 8 October 2025 16:23:06 UTC