Re: [csswg-drafts] [cssom-view] Spec for offsetTop/Left does not match impls when offsetParent is `position:static` `<body>` element (#10549)

The CSS Working Group just discussed ``[cssom-view] Spec for offsetTop/Left does not match impls when offsetParent is `position:static` `<body>` element``, and agreed to the following:

* `RESOLVED: change the spec to match reality around child-of-root BODY elements`

<details><summary>The full IRC log of that discussion</summary>
&lt;noamr> oriol: we encountered this in servo, that impls are not per-spec<br>
&lt;noamr> oriol: offsetTop/offsetLeft of the element, when there is no offsetParent, the distance is used<br>
&lt;noamr> oriol: implementations do something different with body which has position static, they use its parent (document element), and use the border edge instead of a border edge<br>
&lt;noamr> oriol: there's a bug in firefox but the idea is still the same<br>
&lt;noamr> oriol: I think what the spec says makes more sense, that even though browsers are doing something different, we should probably align the spec with reality<br>
&lt;kbabbitt> s/instead of a border edge/instead of a padding edge/<br>
&lt;noamr> astearns: probably browsers wouldn't change this and maintain backwards compat<br>
&lt;TabAtkins> i'm also very sad about this being so weird, but suspect we couldn't fix it without everyone being off by 8px<br>
&lt;noamr> no one likes to touch offsetLeft issues, I tried before<br>
&lt;noamr> oriol: it works differently in nested body elements<br>
&lt;noamr> astearns: so the discrepancy is only about the body?<br>
&lt;noamr> oriol: impls are doing different things for all body elements<br>
&lt;noamr> oriol: maybe that's ok<br>
&lt;noamr> oriol: if it's something is nested we might have to do something, I'm fine either way<br>
&lt;kbabbitt> agree that we probably need to spec current behavior for compat<br>
&lt;noamr> astearns: the simple thing would be to change the spec to match reality<br>
&lt;noamr> astearns: what would be the change?<br>
&lt;noamr> oriol: we'll add a case where if the offset parent is body with position static, we'd take its parent's border edge instead of its padding edge. Need to analyze some details<br>
&lt;noamr> oriol: we could establish for all body elements, or just for body that is a child of a root<br>
&lt;noamr> q-<br>
&lt;astearns> ack fantasai<br>
&lt;Zakim> fantasai, you wanted to ask if this makes sense to make dependent on 'position'<br>
&lt;noamr> fantasai: no strong opinion; our propagation rules for certain thing depend on body being the child of the HTML element<br>
&lt;noamr> fantasai: the value of position makes a difference. Does it make sense to depend on position?<br>
&lt;noamr> oriol: browsers only do this with position:static, otherwise they compute the distance from the body<br>
&lt;noamr> oriol: it would probably be tricky compat-wise to do something else<br>
&lt;noamr> PROPOSED RESOLUTION: change the spec to match reality around child-of-root BODY elements<br>
&lt;flackr> q+<br>
&lt;noamr> fantasai: we should double check with WPT<br>
&lt;astearns> ack flackr<br>
&lt;fantasai> s/double check with WPT/not be checking in WPTs that aren't backed by a spec/<br>
&lt;noamr> flackr: is it just that the body element is position:static, or possibly when the body element is not a containing block? Do we need to worry about position:relative containing position:fixed<br>
&lt;noamr> oriol: if the body establishes a containing block using position, eg fixed inside relative, it would do the normal thing<br>
&lt;astearns> fwiw I’m OK with tests that pass everywhere but are not specced. This points out things we should spec<br>
&lt;noamr> oriol: if it's not the offsetParent, we also do the normal thing. so it needs to be in the containing block chain<br>
&lt;noamr> oriol: if the body is not in the containing block chain, it also wouldn't be the offsetParent and this wouldn't apply<br>
&lt;noamr> flackr: what is the offsetParent with position:fixed<br>
&lt;noamr> oriol: this is only a special case when the body is the offsetParent. So if position prevents the body from being a containing block it would also not be the offsetParent<br>
&lt;noamr> flackr: just making sure there is no additional special case here<br>
&lt;noamr> oriol: just that from what I can see<br>
&lt;noamr> objections?<br>
&lt;noamr> RESOLVED: change the spec to match reality around child-of-root BODY elements<br>
</details>


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


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

Received on Wednesday, 30 October 2024 16:43:27 UTC