Skip to content

Commit

Permalink
🐛 Check for null lastActiveElement
Browse files Browse the repository at this point in the history
Check for a null lastActiveElement before attempting to focus it. This
fixes #1.
  • Loading branch information
jeremyramin committed Sep 9, 2015
1 parent 817068e commit ea7431b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

### v0.1.3 - Patch
* Add more features to README.md
* Fix issue #1
7 changes: 4 additions & 3 deletions lib/view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ class TerminalPlusView extends View

open: =>
lastActiveElement ?= $(document.activeElement)
@panel.show()

if lastOpenedView and lastOpenedView != this
lastOpenedView.hide()
lastOpenedView = this
@statusBar.setActiveTerminalView this
@statusIcon.activate()

@panel.show()
@xterm.height 0
@animating = true
@xterm.height if @maximized then @maxHeight else @prevHeight
Expand All @@ -199,8 +199,9 @@ class TerminalPlusView extends View
@onTransitionEnd =>
@panel.hide()
unless lastOpenedView?
lastActiveElement.focus()
lastActiveElement = null
if lastActiveElement?
lastActiveElement.focus()
lastActiveElement = null

toggle: ->
return if @animating
Expand Down

0 comments on commit ea7431b

Please sign in to comment.