summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-12-04 17:04:42 +0200
committerAlon Levy <alon@pobox.com>2014-12-04 17:04:42 +0200
commit4fdac40d99e8207adf4974606ad3c3837d78ac06 (patch)
treecc59af65a7d8b506f6308949fe88923584244c42 /src
parentfeaaf7ee09e7351801d696023a73238b7ed4a965 (diff)
Fixes #178: handle clicks on the plus button
Diffstat (limited to 'src')
-rw-r--r--src/textanalysis.ui.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/textanalysis.ui.js b/src/textanalysis.ui.js
index 0c0de693..f0bbe105 100644
--- a/src/textanalysis.ui.js
+++ b/src/textanalysis.ui.js
@@ -153,12 +153,22 @@ return {
text = element.val();
element.val("");
analyzeSentence(text, true);
+ text = "";
} else {
suggestionChange = false;
}
}
- plus_button.bind("click", maybeSubmitNewSentence);
+ // Click is required to prevent the default action - this is a form so that's a post,
+ // and away we go.
+ // The mousedown is required because CSS3 transitions eat some events sometimes. This is
+ // the closest I've come to an explanation:
+ // http://stackoverflow.com/questions/15786891/browser-sometimes-ignores-a-jquery-click-event-during-a-css3-transform
+ plus_button.bind("click mousedown", function(e) {
+ console.dir(e);
+ maybeSubmitNewSentence();
+ e.preventDefault();
+ });
var element_keypress = new Bacon.Bus();
rz_bus.ui_key.plug(element_keypress);