Reported by federico.zivolo@gmail.com in https://bugs.chromium.org/p/chromium/issues/detail?id=20574#c67. For the following test case: <!DOCTYPE html> <div id="transformed" style="transform: translateX(2px); height: 50px;"> <div id="fixed" style="position: fixed">FIXED</div> </div> <div id="output" style="height: 3000px"></div> <script> output.textContent = fixed.offsetParent ? fixed.offsetParent.id : "null"; </script> Chrome: null Firefox: transformed Firefox's behavior is more reasonable because "transformed" is the container of "fixed". This issue is somewhat related to https://bugs.webkit.org/show_bug.cgi?id=37839
<rdar://problem/63739636>
" The offsetParent attribute must return the result of running these steps: If any of the following holds true return null and terminate this algorithm: (...) The element’s computed value of the position property is fixed. " https://www.w3.org/TR/cssom-view/#dom-htmlelement-offsetparent
(In reply to Gérard Talbot from comment #2) > " > The offsetParent attribute must return the result of running these steps: > > If any of the following holds true return null and terminate this > algorithm: > > (...) > > The element’s computed value of the position property is fixed. > " > > https://www.w3.org/TR/cssom-view/#dom-htmlelement-offsetparent But that probably hasn't been updated since we made certain CSS properties trigger containing block for fixed position (like transforms and filters). The real question here is whether the 'offsetParent' algorithm should follow containing blocks. Related: bug 161788
I am still able to reproduce this in Safari 15.6 on macOS 12.5 using test case from Comment 0 changed into below JSFiddle: Link - https://jsfiddle.net/ewhjmx3a/show In case of Safari 15.6 and Chrome Canary 106, the output is "FIXED" & "null" on test case while for Firefox Nightly 104, it is "FIXED" & "transformed" aligned with Comment 0. I am not clear on web-spec but I think it should be something which needs to be clarified and all browsers should be on consensus. Just wanted to share updated results. Thanks!