Skip to content

Commit

Permalink
feat(dialog): redispatch the native cancel event
Browse files Browse the repository at this point in the history
fixes #1583

PiperOrigin-RevId: 543884462
  • Loading branch information
Elliott Marquez authored and copybara-github committed Jun 27, 2023
1 parent 4b98674 commit 826262f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dialog/lib/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {html, LitElement, PropertyValues} from 'lit';
import {property, query, state} from 'lit/decorators.js';
import {classMap} from 'lit/directives/class-map.js';

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

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

/**
* A dialog component.
*
* @fires opening Dispatched when the dialog is opening before any animations.
* @fires opened Dispatched when the dialog has opened after any animations.
* @fires closing Dispatched when the dialog is closing before any animations.
* @fires closed Dispatched when the dialog has closed after any animations.
* @fires cancel The native HTMLDialogElement cancel event.
*/
export class Dialog extends LitElement {
private static preventedScrollingCount = 0;
Expand Down Expand Up @@ -472,6 +479,7 @@ export class Dialog extends LitElement {
this.open = false;
this.opening = false;
this.closing = false;
redispatchEvent(this, e);
}

private handleDialogClick(e: Event) {
Expand Down

0 comments on commit 826262f

Please sign in to comment.