22 AfterViewInit ,
33 Directive ,
44 ElementRef ,
5- EventEmitter , Inject ,
5+ EventEmitter ,
66 Input ,
77 OnDestroy ,
88 Optional ,
@@ -29,7 +29,7 @@ import { throwMdePopoverMissingError } from './popover-errors';
2929
3030
3131/**
32- * This directive is intended to be used in conjunction with an md -popover tag. It is
32+ * This directive is intended to be used in conjunction with an mde -popover tag. It is
3333 * responsible for toggling the display of the provided popover instance.
3434 */
3535@Directive ( {
@@ -47,6 +47,7 @@ export class MdePopoverTrigger implements AfterViewInit, OnDestroy {
4747 private _portal : TemplatePortal ;
4848 private _overlayRef : OverlayRef | null = null ;
4949 private _popoverOpen : boolean = false ;
50+ private _halt : boolean = false ;
5051 private _backdropSubscription : Subscription ;
5152 private _positionSubscription : Subscription ;
5253
@@ -188,6 +189,7 @@ export class MdePopoverTrigger implements AfterViewInit, OnDestroy {
188189 }
189190
190191 onMouseOver ( ) {
192+ this . _halt = false ;
191193 if ( this . popover . triggerEvent === 'hover' ) {
192194 this . _mouseoverTimer = setTimeout ( ( ) => {
193195 this . openPopover ( ) ;
@@ -197,17 +199,19 @@ export class MdePopoverTrigger implements AfterViewInit, OnDestroy {
197199
198200 onMouseLeave ( ) {
199201 if ( this . popover . triggerEvent === 'hover' ) {
200- if ( this . _mouseoverTimer ) {
201- clearTimeout ( this . _mouseoverTimer ) ;
202- this . _mouseoverTimer = null ;
203- }
204- if ( this . _popoverOpen ) {
205- setTimeout ( ( ) => {
206- if ( ! this . popover . closeDisabled ) {
207- this . closePopover ( ) ;
208- }
209- } , this . popover . leaveDelay ) ;
210- }
202+ if ( this . _mouseoverTimer ) {
203+ clearTimeout ( this . _mouseoverTimer ) ;
204+ this . _mouseoverTimer = null ;
205+ }
206+ if ( this . _popoverOpen ) {
207+ setTimeout ( ( ) => {
208+ if ( ! this . popover . closeDisabled ) {
209+ this . closePopover ( ) ;
210+ }
211+ } , this . popover . leaveDelay ) ;
212+ } else {
213+ this . _halt = true ;
214+ }
211215 }
212216 }
213217
@@ -218,7 +222,7 @@ export class MdePopoverTrigger implements AfterViewInit, OnDestroy {
218222
219223 /** Opens the popover. */
220224 openPopover ( ) : void {
221- if ( ! this . _popoverOpen ) {
225+ if ( ! this . _popoverOpen && ! this . _halt ) {
222226 this . _createOverlay ( ) . attach ( this . _portal ) ;
223227
224228 /** Only subscribe to backdrop if trigger event is click */
0 commit comments