NEW 212372
Element.offsetParent of fixed position element under transformed element should not be null
https://bugs.webkit.org/show_bug.cgi?id=212372
Summary Element.offsetParent of fixed position element under transformed element shou...
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!
Note You need to log in before you can comment on or make changes to this bug.