geoext / geoext2

GeoExt 2 — JavaScript Toolkit for Rich Web Mapping Applications

Home Page:http://geoext.github.io/geoext2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

z-Index issue in popup-example

chrismayer opened this issue · comments

In the online example for the GeoExt popup (http://geoext.github.io/geoext2/examples/popup/popup.html) seems to be a z-Index issue:
When the popup is open and the user pans the map the popup disappears behind the MapPanel (tested in FF and Chrome)

i can verify this one. it also seems that the "close"-event of the popup isn't triggered, as the feature stays selected after closing the popup, which avoids another popup until you click somewhere else on the map

I think the following happens:

The example has the mappanel inside of a window, and the feature popup is also a window.

If the map is being panned, the containing window is focused and the feature popup then lives below the map. One may argue that this is the correct behaviour in the mentioned example, as we expect a window to gain focus (and to be on top of other windows) once we interact with it.

If we decide that the GeoExt popup is an eminent part of the containing map, than we should ensure that we deal with changes in the z-index of a mappanel (or mor correctly st. that contains a mappanel.)

Perhaps there is a clever configuration somewhere that enables this easily, otherwise we'd setup appropriate listeners.

First thanks to @KaiVolland for tackling this and providing a PR.

About the z-Index issue I am still not sure how to proceed. I agree that one could argument (like @marcjansen wrote) "this is the correct behaviour in the mentioned example, as we expect a window to gain focus (and to be on top of other windows) once we interact with it". But in my small GIS world I would interpret a feature-popup, what is the main purpose of this class, as an "on-top-element" of the map. So I tend to ensure that the popup stays visible, but I am open to any other arguments.

I think for ExtJS 4 we could use this:

diff --git a/src/GeoExt/window/Popup.js b/src/GeoExt/window/Popup.js
index 124a34a..112459f 100644
--- a/src/GeoExt/window/Popup.js
+++ b/src/GeoExt/window/Popup.js
@@ -349,6 +349,7 @@ Ext.define('GeoExt.window.Popup', {
             }

             this.setPosition(left, top);
+            Ext.WindowManager.bringToFront(this.id);
         }
     },

After position() has done its work, we force the window to the front. I think it makes sense to have this configurable (preferable with alwaysOnTop, which we get for free in ExtJS5).

What do you people think?

+1 for having a popup always on top, as a popup behind a map makes no sense at all.
Only downside i could imagine is having other Components floating over the map, which will get overlaid by the popup.

+1 for a configurable config alwaysOnTop

See #312 for the above patch as PR.