<?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>287055</bug_id>
          
          <creation_ts>2025-02-04 17:47:00 -0800</creation_ts>
          <short_desc>toggle &amp;  beforetoggle event not fire when dialog state change</short_desc>
          <delta_ts>2026-03-19 22:59:14 -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>WebCore Misc.</component>
          <version>Safari 18</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 14</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>268160</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Li">meistudioli</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>meistudioli</cc>
    
    <cc>ntim</cc>
    
    <cc>polarbirke</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2092017</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Li">meistudioli</who>
    <bug_when>2025-02-04 17:47:00 -0800</bug_when>
    <thetext>Steps to reproduce the problem:
1. &lt;dialog /&gt; add toggle &amp; beforetoggle event.
2. Call dialog.showModal().
3. event not dispatch.

What is the expected behavior ?
1. toggle &amp; beforetoggle event should dispatch.

What went wrong?
1. toggle &amp; beforetoggle event not dispatch.


Sample code:
&lt;dialog class=&quot;my-dialog&quot;&gt;
  this is a dialog
&lt;/dialog&gt;

&lt;script type=&quot;module&quot;&gt;
const dialog = document.querySelector(&apos;.my-dialog&apos;);

dialog.addEventListener(&apos;beforetoggle&apos;,
  (event) =&gt; {
    console.log(&apos;beforetoggle event&apos;, event);
  }
);

dialog.addEventListener(&apos;toggle&apos;,
  (event) =&gt; {
    console.log(&apos;toggle event&apos;, event);
  }
);

dialog.addEventListener(&apos;close&apos;,
  (event) =&gt; {
    console.log(&apos;close event&apos;, event);
  }
);

dialog.showModal();
&lt;/script&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2094030</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-02-11 17:47:28 -0800</bug_when>
    <thetext>&lt;rdar://problem/144656524&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2155727</commentid>
    <comment_count>2</comment_count>
    <who name="">polarbirke</who>
    <bug_when>2025-11-01 08:55:35 -0700</bug_when>
    <thetext>Can confirm in MacOS Safari 18; seems fixed in MacOS Safari 26.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2191941</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2026-03-19 22:59:14 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 268160 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>