@@ -133,10 +133,11 @@ export class Alert extends ViewController {
133
133
id ?: string
134
134
} > ,
135
135
buttons ?: Array < any > ,
136
- disableClickBackdropToDismiss ?: boolean
136
+ enableBackdropDismiss ?: boolean
137
137
} = { } ) {
138
138
opts . inputs = opts . inputs || [ ] ;
139
139
opts . buttons = opts . buttons || [ ] ;
140
+ opts . enableBackdropDismiss = ( opts . enableBackdropDismiss === false ? false : true ) ;
140
141
141
142
super ( AlertCmp , opts ) ;
142
143
this . viewType = 'alert' ;
@@ -227,7 +228,7 @@ export class Alert extends ViewController {
227
228
id ?: string
228
229
} > ,
229
230
buttons ?: Array < any > ,
230
- disableClickBackdropToDismiss ?: boolean
231
+ enableBackdropDismiss ?: boolean
231
232
} = { } ) {
232
233
return new Alert ( opts ) ;
233
234
}
@@ -373,13 +374,12 @@ class AlertCmp {
373
374
let self = this ;
374
375
self . keyUp = function ( ev ) {
375
376
if ( ev . keyCode === 13 ) {
376
- // enter
377
- console . debug ( 'alert enter' ) ;
377
+ console . debug ( 'alert, enter button' ) ;
378
378
let button = self . d . buttons [ self . d . buttons . length - 1 ] ;
379
379
self . btnClick ( button ) ;
380
380
381
381
} else if ( ev . keyCode === 27 ) {
382
- console . debug ( 'alert escape' ) ;
382
+ console . debug ( 'alert, escape button ' ) ;
383
383
self . bdClick ( ) ;
384
384
}
385
385
} ;
@@ -432,7 +432,7 @@ class AlertCmp {
432
432
}
433
433
434
434
bdClick ( ) {
435
- if ( ! this . d . disableClickBackdropToDismiss ) {
435
+ if ( this . d . enableBackdropDismiss ) {
436
436
let cancelBtn = this . d . buttons . find ( b => b . role === 'cancel' ) ;
437
437
if ( cancelBtn ) {
438
438
this . btnClick ( cancelBtn , 1 ) ;
@@ -470,7 +470,7 @@ class AlertCmp {
470
470
return values ;
471
471
}
472
472
473
- onPageDidLeave ( ) {
473
+ onPageWillLeave ( ) {
474
474
document . removeEventListener ( 'keyup' , this . keyUp ) ;
475
475
}
476
476
}
0 commit comments