Bug 212372

Summary: Element.offsetParent of fixed position element under transformed element should not be null
Product: WebKit Reporter: Federico Zivolo <federico.zivolo>
Component: DOMAssignee: fantasai <fantasai.bugs>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, annevk, ap, bfulgham, browserbugs2, davide.cavarretta, fantasai.bugs, mrobinson, rniwa, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=161788
Bug Depends on:    
Bug Blocks: 289743    

Federico Zivolo
Reported 2020-05-26 06:18:29 PDT
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
Attachments
Radar WebKit Bug Importer
Comment 1 2020-05-28 17:33:12 PDT
Gérard Talbot (no longer involved)
Comment 2 2022-02-28 07:21:49 PST
" 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
Simon Fraser (smfr)
Comment 3 2022-02-28 15:55:11 PST
(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
Ahmad Saleem
Comment 4 2022-07-27 03:51:24 PDT
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!
fantasai
Comment 5 2025-09-16 17:19:49 PDT
fantasai
Comment 6 2025-09-16 17:35:37 PDT
EWS
Comment 7 2025-09-17 12:03:45 PDT
Committed 300097@main (6cd7aec93667): <https://commits.webkit.org/300097@main> Reviewed commits have been landed. Closing PR #50834 and removing active labels.
EWS
Comment 8 2025-09-19 17:22:01 PDT
Committed 297297.443@safari-7622-branch (ec961398d781): <https://commits.webkit.org/297297.443@safari-7622-branch> Reviewed commits have been landed. Closing PR #3673 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.