By using renderTo, we have no knowledge of when the thing that is holding the mask is hidden or shown.
You should do something like this:
Code:
Ext.application({
name: 'Fiddle',
launch: function() {
var pnl = Ext.create('Ext.TabPanel', {
title: 'My Tab Panel',
width: 500,
height: 500,
bodyPadding: 10,
renderTo: Ext.getBody(),
items: [{
title: 'First tab',
xtype: 'panel',
id: 'windowPanel',
items: [{
xtype: 'button',
text: 'show window',
handler: function() {
var window = Ext.getCmp('myWindow');
if (!window) {
window = Ext.getCmp('windowPanel').add({
xtype: 'window',
maxWidth: 450,
constrain: true,
title: 'dummy window',
constrainTo: 'windowPanel',
closeAction: 'hide',
id: 'myWindow',
modal: true,
html: 'The mask of the window should be applied only to this tab because the renderTo and constrainTo configs are set with the tab\'s id.'
});
}
window.show();
}
}]
}, {
title: 'Second tab',
xtype: 'container',
items: [{
xtype: 'button',
text: 'dummy button'
}]
}]
});
}
});