From b97dec43ac6aa534b33a3543976bd57a77840378 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Wed, 3 Oct 2012 22:54:54 +0300 Subject: [PATCH] [popup] Flatten widget methods: move timeout that triggers focus and "popupafteropen" to the widget level --- js/widgets/popup.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/widgets/popup.js b/js/widgets/popup.js index 7f53a543740..47dc538576d 100644 --- a/js/widgets/popup.js +++ b/js/widgets/popup.js @@ -499,6 +499,11 @@ define( [ "jquery", return { x: x, y: y }; }, + _completeOpen: function() { + this._ui.container.attr( "tabindex", "0" ).focus(); + this._trigger( "afteropen" ); + }, + _openPrereqsComplete: function() { var self = this; @@ -509,10 +514,7 @@ define( [ "jquery", // Android appears to trigger the animation complete before the popup // is visible. Allowing the stack to unwind before applying focus prevents // the "blue flash" of element focus in android 4.0 - setTimeout(function(){ - self._ui.container.attr( "tabindex", "0" ).focus(); - self._trigger( "afteropen" ); - }); + setTimeout( $.proxy( this, "_completeOpen" ) ); }, _open: function( options ) {