         text.innerText = textArea.value
 
       group = event.target.parentElement
-      group.classList.remove @LABEL_EDIT_CLASS
+      @changeGroupState group, @State.NORMAL
 
     else if event.keyCode is 27  # ESC key
       group = event.target.parentElement
-      group.classList.remove @LABEL_EDIT_CLASS
+      @changeGroupState group, @State.NORMAL
+
+  changeGroupState: (element, state) ->
+    switch state
+      when @State.EDIT
+        element.classList.add @LABEL_EDIT_CLASS
+      else
+        element.classList.remove @LABEL_EDIT_CLASS
 
   bindSortables: ->
     $('#sortable1, #sortable2, #sortable3').sortable({

  State:
    OPEN: 'open'
    CLOSE: 'close'
  state: null

  OPEN_CLASS: 'pocket-open'

    textArea.focus()

    group = text.parentElement
    @changeGroupState group, @State.EDIT

  onLabelKeyDown: (event) ->
    if event.keyCode is 13  # Return key
