function removeCurrentPopUp(keyEvent) {
        // allow the popUp to prevent closing
        var $popUp,
            i,
            event = new $.Event("popUpClose");

        for (i = _popUps.length - 1; i >= 0; i--) {
            $popUp = $(_popUps[i]);

            if ($popUp.find(":visible").length > 0) {
                $popUp.trigger(event);

                if (!event.isDefaultPrevented()) {
                    // Stop the DOM event from propagating
                    if (keyEvent) {
                        keyEvent.stopImmediatePropagation();
                    }

                    removePopUp($popUp);

                    // TODO: right now Menus and Context Menus do not take focus away from
                    // the editor. We need to have a focus manager to correctly manage focus
                    // between editors and other UI elements.
                    // For now we don't set focus here and assume individual popups
                    // adjust focus if necessary
                    // See story in Trello card #404
                    //EditorManager.focusEditor();
                }

                break;
            }
        }
    }
Remove Esc key handling for a pop-up. Removes the pop-up from the DOM
if the pop-up is currently visible and was not originally attached.

@param {KeyboardEvent=} keyEvent (optional)