<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>296925</bug_id>
          
          <creation_ts>2025-08-05 03:22:12 -0700</creation_ts>
          <short_desc>Modal &lt;dialog&gt; with CSS transition updated offsetParent too early causing unexpected behaviour</short_desc>
          <delta_ts>2025-08-05 11:53:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>Safari 18</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>276727</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adrian">kileras</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ntim</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2134369</commentid>
    <comment_count>0</comment_count>
      <attachid>476284</attachid>
    <who name="Adrian">kileras</who>
    <bug_when>2025-08-05 03:22:12 -0700</bug_when>
    <thetext>Created attachment 476284
Small example with a simple dialog and a &quot;forever&quot; close animation to showcase the issue

Hi!

I have a dialog that is show as a modal with CSS transition to do some animations when its open and closed. 
When we open it the dialog is shown at the center of the viewport, as we set its position with top/left + translate, and the open animation works as expected.
When I close it the animation triggers fine but the dialog suddenly changes its position and goes from being at the center of the viewport to be at the center of the parent element with relative position.
Looking at the details of the dialog it seems that its &quot;offsetParent&quot; is updated as soon as the dialog closes cause the unexpected movement.

Testing the same in Chrome does not move the dialog, its stays at the center, and the &quot;offsetParent&quot; stays &quot;null&quot; until the transition ends.

Unfortunately Firefox doesn&apos;t support transitions in dialog yet. 

So I&apos;m not sure what the spec says regarding this but from a developer point of view it seems sensible to keep the &quot;offsetParent&quot; pinned, otherwise closing transitions can easily introduce unwanted behaviours like this dialog moving around.

I attached a file that showcases this issue, let me know if you need anything else.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134380</commentid>
    <comment_count>1</comment_count>
    <who name="Adrian">kileras</who>
    <bug_when>2025-08-05 05:18:28 -0700</bug_when>
    <thetext>To add to this the same issue happens with popover, as soon as you do `hidePopover()` the `offsetParent` gets updated and the element moves</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134381</commentid>
    <comment_count>2</comment_count>
    <who name="Adrian">kileras</who>
    <bug_when>2025-08-05 05:24:37 -0700</bug_when>
    <thetext>(In reply to Adrian from comment #0)
&gt; Created attachment 476284 [details]
&gt; Small example with a simple dialog and a &quot;forever&quot; close animation to
&gt; showcase the issue
&gt; 
&gt; Hi!
&gt; 
&gt; I have a dialog that is show as a modal with CSS transition to do some
&gt; animations when its open and closed. 
&gt; When we open it the dialog is shown at the center of the viewport, as we set
&gt; its position with top/left + translate, and the open animation works as
&gt; expected.
&gt; When I close it the animation triggers fine but the dialog suddenly changes
&gt; its position and goes from being at the center of the viewport to be at the
&gt; center of the parent element with relative position.
&gt; Looking at the details of the dialog it seems that its &quot;offsetParent&quot; is
&gt; updated as soon as the dialog closes cause the unexpected movement.
&gt; 
&gt; Testing the same in Chrome does not move the dialog, its stays at the
&gt; center, and the &quot;offsetParent&quot; stays &quot;null&quot; until the transition ends.
&gt; 
&gt; Unfortunately Firefox doesn&apos;t support transitions in dialog yet. 
&gt; 
&gt; So I&apos;m not sure what the spec says regarding this but from a developer point
&gt; of view it seems sensible to keep the &quot;offsetParent&quot; pinned, otherwise
&gt; closing transitions can easily introduce unwanted behaviours like this
&gt; dialog moving around.
&gt; 
&gt; I attached a file that showcases this issue, let me know if you need
&gt; anything else.

I have no idea how to edit the original description but in Chrome is not that the dialog &apos;offsetParent&apos; is updated at the end of the transition, its always null</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134457</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2025-08-05 11:53:05 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 276727 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>476284</attachid>
            <date>2025-08-05 03:22:12 -0700</date>
            <delta_ts>2025-08-05 03:22:12 -0700</delta_ts>
            <desc>Small example with a simple dialog and a &quot;forever&quot; close animation to showcase the issue</desc>
            <filename>dialog.animation.issue.html</filename>
            <type>text/html</type>
            <size>2188</size>
            <attacher name="Adrian">kileras</attacher>
            
              <data encoding="base64">PGh0bWw+CiAgPGhlYWQ+CiAgICA8c3R5bGU+CiAgICAqIHsKICAgICAgZm9udC1mYW1pbHk6IC1h
cHBsZS1zeXN0ZW0sIEJsaW5rTWFjU3lzdGVtRm9udCwgIlNlZ29lIFVJIiwgUm9ib3RvLCBIZWx2
ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmLCAiQXBwbGUgQ29sb3IgRW1vamkiLCAiU2Vnb2UgVUkg
RW1vamkiLCAiU2Vnb2UgVUkgU3ltYm9sIjsKICAgIH0KCiAgICAucGFyZW50IHsKICAgICAgYWxp
Z24taXRlbXM6IGNlbnRlcjsKICAgICAgZGlzcGxheTogZmxleDsKICAgICAgaGVpZ2h0OiAyMDBw
eDsKICAgICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7CiAgICAgIG1hcmdpbjogMCBhdXRvOwog
ICAgICBvdXRsaW5lOiAycHggc29saWQgYmx1ZTsKICAgICAgcG9zaXRpb246IHJlbGF0aXZlOwog
ICAgICB3aWR0aDogMjAwcHg7CiAgICB9Cgog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