Add handler to close post widget on ESC
authorChip Black <bytex64@bytex64.net>
Mon, 17 Mar 2014 20:40:44 +0000 (15:40 -0500)
committerChip Black <bytex64@bytex64.net>
Mon, 17 Mar 2014 20:40:44 +0000 (15:40 -0500)
www/jssrc/blerg/Post.js

index f39520e..221d56a 100644 (file)
@@ -5,7 +5,8 @@ enyo.kind({
     handlers: {
         onPostVisibility: "postVisibilityUpdate",
         onLogin: "loggedIn",
-        onLogout: "loggedOut"
+        onLogout: "loggedOut",
+        onkeydown: "keyHandler"
     },
     components: [
         {tag: "h2", content: "What's on your mind?"},
@@ -93,6 +94,7 @@ enyo.kind({
             this.$.toolbar.reflow();
             this.reflow();
         } else {
+            this.$.postContent.node.blur();
             setTimeout(function() {
                 this.hide();
                 this.removeClass('exit');
@@ -132,4 +134,9 @@ enyo.kind({
             this.loadHelp();
         }
     },
+    keyHandler: function(inSender, inEvent) {
+        if (inEvent.which == 27) {
+            this.closePost();
+        }
+    }
 });