Add handler to close post widget on ESC
[blerg.git] / 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();
+        }
+    }
 });