@@ -71,18 +71,17 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
71
71
*/
72
72
this . $get = [ '$window' , '$compile' , '$timeout' , '$document' , '$uibPosition' , '$interpolate' , '$rootScope' , '$parse' , '$$stackedMap' , function ( $window , $compile , $timeout , $document , $position , $interpolate , $rootScope , $parse , $$stackedMap ) {
73
73
var openedTooltips = $$stackedMap . createNew ( ) ;
74
- $document . on ( 'keypress ' , keypressListener ) ;
74
+ $document . on ( 'keyup ' , keypressListener ) ;
75
75
76
76
$rootScope . $on ( '$destroy' , function ( ) {
77
- $document . off ( 'keypress ' , keypressListener ) ;
77
+ $document . off ( 'keyup ' , keypressListener ) ;
78
78
} ) ;
79
79
80
80
function keypressListener ( e ) {
81
81
if ( e . which === 27 ) {
82
82
var last = openedTooltips . top ( ) ;
83
83
if ( last ) {
84
84
last . value . close ( ) ;
85
- openedTooltips . removeTop ( ) ;
86
85
last = null ;
87
86
}
88
87
}
@@ -207,9 +206,6 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
207
206
// By default, the tooltip is not open.
208
207
// TODO add ability to start tooltip opened
209
208
ttScope . isOpen = false ;
210
- openedTooltips . add ( ttScope , {
211
- close : hide
212
- } ) ;
213
209
214
210
function toggleTooltipBind ( ) {
215
211
if ( ! ttScope . isOpen ) {
@@ -336,6 +332,10 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
336
332
}
337
333
} ) ;
338
334
335
+ openedTooltips . add ( ttScope , {
336
+ close : hide
337
+ } ) ;
338
+
339
339
prepObservers ( ) ;
340
340
}
341
341
@@ -348,6 +348,9 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
348
348
tooltip . remove ( ) ;
349
349
tooltip = null ;
350
350
}
351
+
352
+ openedTooltips . remove ( ttScope ) ;
353
+
351
354
if ( tooltipLinkedScope ) {
352
355
tooltipLinkedScope . $destroy ( ) ;
353
356
tooltipLinkedScope = null ;
@@ -563,7 +566,6 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
563
566
scope . $on ( '$destroy' , function onDestroyTooltip ( ) {
564
567
unregisterTriggers ( ) ;
565
568
removeTooltip ( ) ;
566
- openedTooltips . remove ( ttScope ) ;
567
569
ttScope = null ;
568
570
} ) ;
569
571
} ;
0 commit comments