Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit b97dec4

Browse files
author
Gabriel Schulhof
committed
[popup] Flatten widget methods: move timeout that triggers focus and "popupafteropen" to the widget level
1 parent ff74d34 commit b97dec4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

js/widgets/popup.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,11 @@ define( [ "jquery",
499499
return { x: x, y: y };
500500
},
501501

502+
_completeOpen: function() {
503+
this._ui.container.attr( "tabindex", "0" ).focus();
504+
this._trigger( "afteropen" );
505+
},
506+
502507
_openPrereqsComplete: function() {
503508
var self = this;
504509

@@ -509,10 +514,7 @@ define( [ "jquery",
509514
// Android appears to trigger the animation complete before the popup
510515
// is visible. Allowing the stack to unwind before applying focus prevents
511516
// the "blue flash" of element focus in android 4.0
512-
setTimeout(function(){
513-
self._ui.container.attr( "tabindex", "0" ).focus();
514-
self._trigger( "afteropen" );
515-
});
517+
setTimeout( $.proxy( this, "_completeOpen" ) );
516518
},
517519

518520
_open: function( options ) {

0 commit comments

Comments
 (0)