   remove: (selector, keepData) ->
     return super if keepData
 
-    if @is(':has(:focus)')
-      @getContainer().focusNextPane() or atom.workspaceView?.focus()
-    else if @isActive()
+    @unsubscribe()
+    @model.destroy() unless @model.isDestroyed()
+
+    if @isActive()
       @getContainer().makeNextPaneActive()
 
-    @parent().view().removeChild(this) unless keepData
-    item.destroy?() for item in @getItems()
-
     super

    @itemViews.children().not(view).hide()
    @itemViews.append(view) unless view.parent().is(@itemViews)
    view.show() if @attached
    view.focus() if isFocused
    @activeView = view
    @trigger 'pane:active-item-changed', [item]


    @onItemAdded(item) for item in @items
    @viewsByItem = new WeakMap()
    @handleEvents()

  hasFocus: ->
    @is(':focus') or @is(':has(:focus)')

  handleEvents: ->
    @subscribe @model.$activeItem, 'value', @onActiveItemChanged
