         else
           options.callback(options.data, @getPreviouslyFocusedElement())
 
+        @restoreFocus()
+
     @on 'mouseover', =>
       @storeFocusedElement()
 

{CompositeDisposable} = require 'atom'
{View} = require 'space-pen'

module.exports = class ToolBarButtonView extends View
  @content: ->

    else
      @eventElement = atom.views.getView(atom.workspace)

  restoreFocus: ->
    previouslyFocusedElement = $(@previouslyFocusedElement)
    if previouslyFocusedElement?.isOnDom()?
      previouslyFocusedElement.focus()
    else
      atom.workspace.focus()

  storeFocusedElement: ->
    if not document.activeElement.classList.contains 'tool-bar-btn'
      @previouslyFocusedElement = document.activeElement
