Skip to content

Commit 826262f

Browse files
Elliott Marquezcopybara-github
authored andcommitted
feat(dialog): redispatch the native cancel event
fixes #1583 PiperOrigin-RevId: 543884462
1 parent 4b98674 commit 826262f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dialog/lib/dialog.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {html, LitElement, PropertyValues} from 'lit';
1010
import {property, query, state} from 'lit/decorators.js';
1111
import {classMap} from 'lit/directives/class-map.js';
1212

13+
import {redispatchEvent} from '../../internal/controller/events.js';
1314
import {createThrottle, msFromTimeCSSValue} from '../../internal/motion/animation.js';
1415

1516
// This is required for decorators.
@@ -25,6 +26,12 @@ const CLOSING_TRANSITION_PROP = '--_closing-transition-duration';
2526

2627
/**
2728
* A dialog component.
29+
*
30+
* @fires opening Dispatched when the dialog is opening before any animations.
31+
* @fires opened Dispatched when the dialog has opened after any animations.
32+
* @fires closing Dispatched when the dialog is closing before any animations.
33+
* @fires closed Dispatched when the dialog has closed after any animations.
34+
* @fires cancel The native HTMLDialogElement cancel event.
2835
*/
2936
export class Dialog extends LitElement {
3037
private static preventedScrollingCount = 0;
@@ -472,6 +479,7 @@ export class Dialog extends LitElement {
472479
this.open = false;
473480
this.opening = false;
474481
this.closing = false;
482+
redispatchEvent(this, e);
475483
}
476484

477485
private handleDialogClick(e: Event) {

0 commit comments

Comments
 (0)