Skip to content

Conversation

@vincentbernat
Copy link

Starting with Firefox 144, offsetParent is now null when an element has position fixed (while previously, it would return <body>). The hack previously used for Firefox is not working anymore and we have to use the same method as for Chromium.

I don't have a reference for the change. The bug on Firefox side is still open but with an activity a few months ago. There are also traces it has been fixed in some subsequent commits.

Starting with Firefox 144, offsetParent is now `null` when an element
has position fixed (while previously, it would return `<body>`). The
hack previously used for Firefox is not working anymore and we have to
use the same method as for Chromium.
@marijnh
Copy link
Member

marijnh commented Oct 21, 2025

I'm still seeing the old behavior in Firefox 144. This is the test I used.

<div style="transform: translate(50px, 50px)"><div id=fix style="position: fixed; left: 0; right: 0">--</div></div>
<script>console.log(document.querySelector("#fix").offsetParent)</script>

@vincentbernat
Copy link
Author

vincentbernat commented Oct 21, 2025

I just took a random element on this page:

10:42:31.379 temp0.style.position = "fixed"
10:42:31.410 "fixed"
10:42:40.464 temp0.offsetParent
10:42:40.488 null 

marijnh added a commit that referenced this pull request Oct 21, 2025
Now that browsers seem to properly set offsetParent to null for fixed elements.

FIX: Make detection of transformed tooltip parent elements (forcing absolute
positioning) more robust on current browsers.

Issue #74
@marijnh
Copy link
Member

marijnh commented Oct 21, 2025

That looks like an improvement—null is actually a useful value there. And from what I can see, recent Chrome versions are also behaving like this now. Does attached patch look like it would work for you?

@vincentbernat
Copy link
Author

Yes, it works fine as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants