File tree Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export class DialogRef<T, R = any> {
62
62
}
63
63
64
64
/** Gets an observable that emits when the overlay's backdrop has been clicked. */
65
- backdropClick ( ) : Observable < void > {
65
+ backdropClick ( ) : Observable < MouseEvent > {
66
66
return this . _overlayRef . backdropClick ( ) ;
67
67
}
68
68
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export type ImmutableObject<T> = {
27
27
*/
28
28
export class OverlayRef implements PortalOutlet {
29
29
private _backdropElement : HTMLElement | null = null ;
30
- private _backdropClick : Subject < any > = new Subject ( ) ;
30
+ private _backdropClick : Subject < MouseEvent > = new Subject ( ) ;
31
31
private _attachments = new Subject < void > ( ) ;
32
32
private _detachments = new Subject < void > ( ) ;
33
33
@@ -181,7 +181,7 @@ export class OverlayRef implements PortalOutlet {
181
181
}
182
182
183
183
/** Gets an observable that emits when the backdrop has been clicked. */
184
- backdropClick ( ) : Observable < void > {
184
+ backdropClick ( ) : Observable < MouseEvent > {
185
185
return this . _backdropClick . asObservable ( ) ;
186
186
}
187
187
@@ -278,7 +278,8 @@ export class OverlayRef implements PortalOutlet {
278
278
279
279
// Forward backdrop clicks such that the consumer of the overlay can perform whatever
280
280
// action desired when such a click occurs (usually closing the overlay).
281
- this . _backdropElement . addEventListener ( 'click' , ( ) => this . _backdropClick . next ( null ) ) ;
281
+ this . _backdropElement . addEventListener ( 'click' ,
282
+ ( event : MouseEvent ) => this . _backdropClick . next ( event ) ) ;
282
283
283
284
// Add class to fade-in the backdrop after one frame.
284
285
if ( typeof requestAnimationFrame !== 'undefined' ) {
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ describe('Overlay', () => {
388
388
overlayRef . backdropClick ( ) . subscribe ( backdropClickHandler ) ;
389
389
390
390
backdrop . click ( ) ;
391
- expect ( backdropClickHandler ) . toHaveBeenCalled ( ) ;
391
+ expect ( backdropClickHandler ) . toHaveBeenCalledWith ( jasmine . any ( MouseEvent ) ) ;
392
392
} ) ;
393
393
394
394
it ( 'should complete the backdrop click stream once the overlay is destroyed' , ( ) => {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ export class MatDialogRef<T, R = any> {
141
141
/**
142
142
* Gets an observable that emits when the overlay's backdrop has been clicked.
143
143
*/
144
- backdropClick ( ) : Observable < void > {
144
+ backdropClick ( ) : Observable < MouseEvent > {
145
145
return this . _overlayRef . backdropClick ( ) ;
146
146
}
147
147
You can’t perform that action at this time.
0 commit comments