From 716c7de97cdf52ff51f081c8d82c71f1b91b7995 Mon Sep 17 00:00:00 2001 From: Ron Michael Zettlemoyer Date: Mon, 9 Oct 2017 17:19:53 -0400 Subject: [PATCH] trigger mouse selection on mousedown not click Not entirely sure why click works in the demo but not in my code. In my code the click would happen after the selection was switched to the dropdown so the range was wrong. Changing it to mousedown prevents the selection/range from leaving the input box. --- src/view.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view.coffee b/src/view.coffee index 08785d73..873111f0 100644 --- a/src/view.coffee +++ b/src/view.coffee @@ -34,7 +34,7 @@ class View return if $cur.hasClass('cur') $menu.find('.cur').removeClass 'cur' $cur.addClass 'cur' - .on 'click.atwho-view', 'li', (e) => + .on 'mousedown.atwho-view', 'li', (e) => $menu.find('.cur').removeClass 'cur' $(e.currentTarget).addClass 'cur' this.choose(e)