'+
+ subpanel: '
'
},
@@ -257,6 +257,11 @@ define('modal', ['mailpoet', 'jquery'],
// add sub panel content
jQuery('.mailpoet_'+this.options.type+'_body').last()
.html(this.subpanels[(this.subpanels.length - 1)].element);
+
+ // focus on sub panel
+ if(this.options.focus) {
+ this.focus();
+ }
} else if (this.options.element) {
jQuery('.mailpoet_'+this.options.type+'_body').empty();
jQuery('.mailpoet_'+this.options.type+'_body')
@@ -398,7 +403,7 @@ define('modal', ['mailpoet', 'jquery'],
}
if(this.options.focus) {
- jQuery('#mailpoet_'+this.options.type).focus();
+ this.focus();
}
// set popup as opened
@@ -411,6 +416,16 @@ define('modal', ['mailpoet', 'jquery'],
return this;
},
+ focus: function() {
+ if(this.options.type == 'popup') {
+ jQuery('#mailpoet_'+this.options.type).focus();
+ } else {
+ // panel and subpanel
+ jQuery('#mailpoet_'+this.options.type+' .mailpoet_panel_wrapper')
+ .filter(':visible').focus();
+ }
+ return this;
+ },
highlightOn: function(element) {
jQuery(element).addClass('mailpoet_modal_highlight');
return this;
@@ -450,8 +465,6 @@ define('modal', ['mailpoet', 'jquery'],
options.type = 'popup';
// set overlay state
options.overlay = options.overlay || true;
- // set focus state
- options.focus = options.focus || true;
// initialize modal
this.init(options);
// open modal
@@ -594,6 +607,11 @@ define('modal', ['mailpoet', 'jquery'],
// remove last subpanels
this.subpanels.pop();
+ // focus on previous panel
+ if(this.options.focus) {
+ this.focus();
+ }
+
return this;
}