function ModalBar(template, autoClose, animate) {
        if (animate === undefined) {
            animate = true;
        }

        this._handleKeydown = this._handleKeydown.bind(this);
        this._handleFocusChange = this._handleFocusChange.bind(this);

        this._$root = $("<div class='modal-bar'/>")
            .html(template)
            .insertBefore("#editor-holder");

        if (animate) {
            this._$root.addClass("popout offscreen");
            // Forcing the renderer to do a layout, which will cause it to apply the transform for the "offscreen"
            // class, so it will animate when you remove the class.
            window.getComputedStyle(this._$root.get(0)).getPropertyValue("top");
            this._$root.removeClass("popout offscreen");
        }

        // If something *other* than an editor (like another modal bar) has focus, set the focus
        // to the editor here, before opening up the new modal bar. This ensures that the old
        // focused item has time to react and close before the new modal bar is opened.
        // See bugs #4287 and #3424
        MainViewManager.focusActivePane();

        if (autoClose) {
            this._autoClose = true;
            this._$root.on("keydown", this._handleKeydown);
            window.document.body.addEventListener("focusin", this._handleFocusChange, true);

            // Set focus to the first input field, or the first button if there is no input field.
            // TODO: remove this logic?
            var $firstInput = $("input[type='text']", this._$root).first();
            if ($firstInput.length > 0) {
                $firstInput.focus();
            } else {
                $("button", this._$root).first().focus();
            }
        }

        // Preserve scroll position of the current full editor across the editor refresh, adjusting for the
        // height of the modal bar so the code doesn't appear to shift if possible.
        MainViewManager.cacheScrollState(MainViewManager.ALL_PANES);
        WorkspaceManager.recomputeLayout();  // changes available ht for editor area
        MainViewManager.restoreAdjustedScrollState(MainViewManager.ALL_PANES, this.height());
    }
Creates a modal bar whose contents are the given template.

Dispatches one event:
- close - When the bar is closed, either via close() or via autoClose. After this event, the
    bar may remain visible and in the DOM while its closing animation is playing. However,
    by the time "close" is fired, the bar has been "popped out" of the layout and the
    editor scroll position has already been restored.
    Second argument is the reason for closing (one of ModalBar.CLOSE_*).
    Third argument is the Promise that close() will be returning.

@constructor

@param {string} template The HTML contents of the modal bar.
@param {boolean} autoClose If true, then close the dialog if the user hits Esc
     or if the bar loses focus.
@param {boolean} animate If true (the default), animate the dialog closed, otherwise
     close it immediately.