Commit b62a0dc7 authored by Oleg Zharkov's avatar Oleg Zharkov
Browse files

fix dowpdown close

parent 7ff6a0a2
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
        </template>
    </b-nav-item>
    <b-nav-item-dropdown
        @blur="hideDropdown"
        ref="dropdown"
        v-else
        :class="classes"
@@ -111,20 +112,13 @@ export default {
            return document.getElementById("galaxy_main");
        },
    },
    updated() {
        if (this.$refs.dropdown && this.galaxyIframe) {
            this.galaxyIframe.addEventListener("load", this.iframeListener);
        }
    mounted() {
        window.addEventListener("blur", () => this.hideDropdown());
    },
    destroyed() {
        if (this.$refs.dropdown && this.galaxyIframe) {
            this.galaxyIframe.removeEventListener("load", this.iframeListener);
        }
        window.removeEventListener("blur", () => this.hideDropdown());
    },
    methods: {
        iframeListener() {
            return this.galaxyIframe.contentDocument.addEventListener("click", this.hideDropdown);
        },
        hideDropdown() {
            if (this.$refs.dropdown) this.$refs.dropdown.hide();
        },