Permalink
Browse files

Select: Unwind stack before blur()ing in response to change

(cherry picked from commit 32bc2e9)

Closes gh-7723
Fixes gh-7685
1 parent 545b66e commit edcdd51c5cc1812427babde1dd596222b3fa5983 @gabrielschulhof gabrielschulhof committed Sep 25, 2014
Showing with 20 additions and 1 deletion.
  1. +3 −1 js/widgets/forms/select.js
  2. +4 −0 tests/unit/select/index.html
  3. +13 −0 tests/unit/select/select_core.js
@@ -143,7 +143,9 @@ $.widget( "mobile.selectmenu", $.extend( {
self.refresh();
if ( !!options.nativeMenu ) {
- this.blur();
+ self._delay( function() {
+ self.select.blur();
+ });
}
});
@@ -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>
@@ -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() {

0 comments on commit edcdd51

Please sign in to comment.