         activePopovers.splice(index, 1) if this is popover
 
       @el.detach()
+      @trigger.attr 'aria-expanded', false
       clearInterval @positionInterval
       $(window).unbind 'click', @outsideClickHandler
-
-      @trigger.focus() if @trigger && @trigger.is(':visible')
 
     ignoreOutsideClickSelector: '.ui-dialog'
 

      @trigger = $(clickEvent.currentTarget)
      @el = $(@content)
              .addClass('carat-bottom')
              .attr( "role", "dialog" )
              .data('popover', this)
              .keyup (event) =>
                @hide() if event.keyCode is $.ui.keyCode.ESCAPE
      @el.delegate '.popover_close', 'click', (event) =>
        event.preventDefault()
        @hide()

      @show(clickEvent)


      activePopovers.push(this)
      id = "popover-#{idCounter++}"
      @trigger.attr
        "aria-expanded" : true
        "aria-controls" : id
      @previousTarget = clickEvent.currentTarget

      @el
        .attr(
          'id' : id
        )
        .appendTo(document.body)
        .show()
      @position()
      @el.find(':tabbable').first().focus()
      setTimeout(
        () =>
          @el.find(':tabbable').first().focus()
        , 100
      )

      # handle sticking the carat right above where you clicked on the button, bounded by the dialog
      @el.find(".ui-menu-carat").remove()
