- From: Joe Pea via GitHub <noreply@w3.org>
- Date: Wed, 03 Dec 2025 19:53:34 +0000
- To: public-css-archive@w3.org
I hadn't ran into this before, but now that I've realized this change happened like a decade ago, I realize that offset values in the presence of a ShadowRoot are effectively useless because of this. Typically offset values are used to calculate positioning relative to a CSS layout, but this destroys that ability in the presence of a ShadowRoot when that layout is inside the ShadowRoot, especially for _slotted children that the consumer of a custom element controls_. Much like `Element.shadowRoot`, it would have been a ton better to only make `offsetParent` be `null`, while keeping numerical properties like `offsetTop` producing the same values, if we really *really* thought the "encapsulation" was actually worth it here (ten years later, and the best practice is to avoid closed shadow roots to begin with, and they're not actually secure in many cases without going through extremely great lengths). Here's an example _without_ Shadow DOM that shows expected offset values: https://jsbin.com/piyisidace/edit?html,console,output Here's an example _with_ ShadowDOM showing values that are hard to make sense of: https://jsbin.com/fecuresaze/edit?html,console,output -- GitHub Notification of comment by trusktr Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/159#issuecomment-3608585114 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 3 December 2025 19:53:35 UTC