Search code examples
vue.jsleafletvuetify.js

Leaflet+Vue+Vuetify / Leaflet map hide vuetify popup dialog


On my Vuetify + Lealflet project the map hides all popup dialogs and I don't know why. I use Vue2Leaflet library. I am a beginner with web development. Here is a pic of the problem:

enter image description here

               <l-map
                                :center="center"
                                :zoom="zoom"
                                @click.right="mapRclicked"
                                ref="map"
                                style="height: 50vh; width: 50vh"
                >

Solution

  • The problem is a clash of z-index ranges. Vuetify uses z-index ranges 0-10 while leaflet uses the range 100-1100. Fortunately, the z-index of a child element is relative to the z-index of their parent.

    I advice you to give l-map a z-index of 0 like this.

    <l-map
      :center="center"
      :zoom="zoom"
      @click.right="mapRclicked"
      ref="map"
      style="z-index: 0; height: 50vh; width: 50vh"
    >
    

    This will automatically bring your component in line with all of Vuetify z-indexes. In contrast, @bgsuello workaround requires that you modify the z-index of every Vuetify component that may conflict with the map, including other dialogs, menus, animations, tabs, toolbars, snackbars...