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

Commit

Permalink
Select: Unwind stack before blur()ing in response to change
Browse files Browse the repository at this point in the history
(cherry picked from commit 32bc2e9)

Closes gh-7723
Fixes gh-7685
  • Loading branch information
Gabriel Schulhof committed Oct 24, 2014
1 parent 545b66e commit edcdd51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/widgets/forms/select.js
Expand Up @@ -143,7 +143,9 @@ $.widget( "mobile.selectmenu", $.extend( {
self.refresh();

if ( !!options.nativeMenu ) {
this.blur();
self._delay( function() {
self.select.blur();
});
}
});

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/select/index.html
Expand Up @@ -50,6 +50,10 @@
<option value="3">The 3rd Option</option>
<option value="4">The 4th Option</option>
</select>
<select id="blur-test">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
</div>
</div>
</body>
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/select/select_core.js
Expand Up @@ -4,6 +4,19 @@

(function($){

module( "Native select" );

test( "Native select does not blur synchronously in response to change", function() {
var selectmenu = $( "#blur-test" );

selectmenu.focus();

selectmenu.trigger( "change" );

deepEqual( selectmenu.parent().hasClass( "ui-focus" ), true,
"Native select is focused after triggering 'change'" );
});

module( "Custom select" );

test( "Custom select is enhanced correctly", function() {
Expand Down

0 comments on commit edcdd51

Please sign in to comment.