diff --git a/coffee/chosen.jquery.coffee b/coffee/chosen.jquery.coffee index fe76f2a4ee9..95f69cf820d 100644 --- a/coffee/chosen.jquery.coffee +++ b/coffee/chosen.jquery.coffee @@ -69,8 +69,8 @@ class Chosen extends AbstractChosen @form_field_jq.trigger("chosen:ready", {chosen: this}) register_observers: -> - @container.bind 'touchstart.chosen', (evt) => this.container_mousedown(evt); evt.preventDefault() - @container.bind 'touchend.chosen', (evt) => this.container_mouseup(evt); evt.preventDefault() + @container.bind 'touchstart.chosen', (evt) => this.container_mousedown(evt); return + @container.bind 'touchend.chosen', (evt) => this.container_mouseup(evt); return @container.bind 'mousedown.chosen', (evt) => this.container_mousedown(evt); return @container.bind 'mouseup.chosen', (evt) => this.container_mouseup(evt); return @@ -129,7 +129,7 @@ class Chosen extends AbstractChosen container_mousedown: (evt) -> return if @is_disabled - if evt and evt.type is "mousedown" and not @results_showing + if evt and evt.type in ['mousedown', 'touchstart'] and not @results_showing evt.preventDefault() if not (evt? and ($ evt.target).hasClass "search-choice-close") diff --git a/coffee/chosen.proto.coffee b/coffee/chosen.proto.coffee index 0e71614871e..328e44f1ff1 100644 --- a/coffee/chosen.proto.coffee +++ b/coffee/chosen.proto.coffee @@ -50,8 +50,8 @@ class @Chosen extends AbstractChosen @form_field.fire("chosen:ready", {chosen: this}) register_observers: -> - @container.observe "touchstart", (evt) => this.container_mousedown(evt); evt.preventDefault() - @container.observe "touchend", (evt) => this.container_mouseup(evt); evt.preventDefault() + @container.observe "touchstart", (evt) => this.container_mousedown(evt) + @container.observe "touchend", (evt) => this.container_mouseup(evt) @container.observe "mousedown", (evt) => this.container_mousedown(evt) @container.observe "mouseup", (evt) => this.container_mouseup(evt) @@ -124,8 +124,8 @@ class @Chosen extends AbstractChosen container_mousedown: (evt) -> return if @is_disabled - if evt and evt.type is "mousedown" and not @results_showing - evt.stop() + if evt and evt.type in ['mousedown', 'touchstart'] and not @results_showing + evt.preventDefault() if not (evt? and evt.target.hasClassName "search-choice-close") if not @active_field