Created
December 21, 2013 12:51
-
-
Save juandopazo/8068955 to your computer and use it in GitHub Desktop.
Panel focus patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Y.Panel.prototype._uiSetHostVisibleModal = function (visible) { | |
var stack = Y.WidgetModality.STACK, | |
maskNode = this.get('maskNode'), | |
isModal = this.get('modal'), | |
topModal, index; | |
if (visible) { | |
Y.Array.each(stack, function (modal) { | |
modal._detachUIHandlesModal(); | |
modal._blur(); | |
}); | |
// push on top of stack | |
stack.unshift(this); | |
this._repositionMask(this); | |
this._uiSetHostZIndexModal(this.get('zIndex')); | |
if (isModal) { | |
maskNode.show(); | |
Y.later(1, this, '_attachUIHandlesModal'); | |
Y.later(1, this, '_focus'); | |
} | |
} else { | |
index = Y.Array.indexOf(stack, this); | |
if (index >= 0) { | |
// Remove modal widget from global stack. | |
stack.splice(index, 1); | |
} | |
this._detachUIHandlesModal(); | |
this._blur(); | |
if (stack.length) { | |
topModal = stack[0]; | |
this._repositionMask(topModal); | |
//topModal._attachUIHandlesModal(); | |
topModal._uiSetHostZIndexModal(topModal.get('zIndex')); | |
if (topModal.get('modal')) { | |
//topModal._attachUIHandlesModal(); | |
Y.later(1, topModal, '_attachUIHandlesModal'); | |
topModal._focus(); | |
} | |
} else { | |
if (maskNode.getStyle('display') === 'block') { | |
maskNode.hide(); | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment