Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

abstracted out some of the page hide behavior to fix issues with the …

…close button not returning focus to the button after closing. Also fixes an issue where a full page custom menu would open as a misplaced small custom menu the second time it opens (if the menu was closed via the custom close button). Fixes #1618. Fixes #1692. Fixes #1750.
  • Loading branch information...
commit ada46734ecd45bb9f964e925ed228fb5f1607376 1 parent 2de817d
scottjehl authored
Showing with 15 additions and 13 deletions.
  1. +15 −13 js/jquery.mobile.forms.select.js
View
28 js/jquery.mobile.forms.select.js
@@ -305,6 +305,13 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
break;
}
});
+
+ // button refocus ensures proper height calculation
+ // by removing the inline style and ensuring page inclusion
+ self.menuPage.bind( "pagehide", function(){
+ self.list.appendTo( self.listbox );
+ self._focusButton();
+ });
// Events on "screen" overlay
screen.bind( "vclick", function( event ) {
@@ -551,6 +558,13 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
self.isOpen = true;
}
},
+
+ _focusButton : function(){
+ var self = this;
+ setTimeout(function() {
+ self.button.focus();
+ }, 40);
+ },
close: function() {
if ( this.options.disabled || !this.isOpen || this.options.nativeMenu ) {
@@ -559,19 +573,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
var self = this;
- function focusButton() {
- setTimeout(function() {
- self.button.focus();
- }, 40);
-
- self.listbox.removeAttr( "style" ).append( self.list );
- }
-
if ( self.menuType == "page" ) {
- // button refocus ensures proper height calculation
- // by removing the inline style and ensuring page inclusion
- self.menuPage.one( "pagehide", focusButton);
-
// doesn't solve the possible issue with calling change page
// where the objects don't define data urls which prevents dialog key
// stripping - changePage has incoming refactor
@@ -580,7 +582,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
else{
self.screen.addClass( "ui-screen-hidden" );
self.listbox.addClass( "ui-selectmenu-hidden" ).removeAttr( "style" ).removeClass( "in" );
- focusButton();
+ self._focusButton();
}
// allow the dialog to be closed again

0 comments on commit ada4673

Please sign in to comment.
Something went wrong with that request. Please try again.