     @dom.el.on 'click', @dom.closeButtonSelector, (event) ->
       self.close()
 
+    @isFormElement = (element) ->
+      element.type || $(element).is('[contenteditable]')
     @createDimensions = ->
       new @options.dimensionsType(@overlayContent.find('.js-overlay-image'))
 


  next: ->
    target = $(@selector)[@index + 1]
    @open(target)

  previous: ->
    target = $(@selector)[@index - 1]
    @open(target)

  setCommentPaneHeight: =>

    @dom.mask.click (event) ->
      self.close()

    $('body').on 'keyup', (event) ->
      return if self.isFormElement(event.target)
      switch event.which
        when 27 then self.close()
        when 37 then self.previous()
        when 39 then self.next()

    @dom.el.on 'click', @dom.nextButtonSelector, (event) ->
      self.next()
