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

Commit 29eaf47

Browse files
Selectmenu: the preventFocusZoom option check needs to be insde the event binding.
1 parent 466cca6 commit 29eaf47

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

js/widgets/forms/select.js

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,34 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
185185
});
186186

187187
// In many situations, iOS will zoom into the select upon tap, this prevents that from happening
188-
if ( self.options.preventFocusZoom ) {
189-
self.button.bind( "vmousedown", function() {
190-
$.mobile.zoom.disable( true );
191-
});
192-
self.label.bind( "click focus", function() {
193-
$.mobile.zoom.disable( true );
194-
});
195-
self.select.bind( "focus", function() {
196-
$.mobile.zoom.disable( true );
197-
});
198-
self.button.bind( "mouseup", function() {
188+
self.button.bind( "vmousedown", function() {
189+
if ( self.options.preventFocusZoom ) {
190+
$.mobile.zoom.disable( true );
191+
}
192+
});
193+
self.label.bind( "click focus", function() {
194+
if ( self.options.preventFocusZoom ) {
195+
$.mobile.zoom.disable( true );
196+
}
197+
});
198+
self.select.bind( "focus", function() {
199+
if ( self.options.preventFocusZoom ) {
200+
$.mobile.zoom.disable( true );
201+
}
202+
});
203+
self.button.bind( "mouseup", function() {
204+
if ( self.options.preventFocusZoom ) {
199205
setTimeout(function() {
200206
$.mobile.zoom.enable( true );
201207
}, 0 );
202-
});
203-
self.select.bind( "blur", function() {
208+
}
209+
});
210+
self.select.bind( "blur", function() {
211+
if ( self.options.preventFocusZoom ) {
204212
$.mobile.zoom.enable( true );
205-
});
206-
}
213+
}
214+
});
215+
207216
},
208217

209218
selected: function() {

0 commit comments

Comments
 (0)