Open markconroy opened 1 year ago
I'm not replicating this issue, is this Gin or Claro or a different admin theme? Is it using the localgov_geo module that has the map in the popup, or embedding a location field directly into the node edit form? Just to make sure if it is an issue, we fix it in the right place. If it does effect other forms, then maybe the localgov_admin_theme_improvements module would be a better place for the fix?
It's embedding the map into the form rather than in a modal. We had this issue before and it was basically fixed by moving to having the geobrowser modal in place of the inline form.
There are a host of issues on drupal.org about this:
https://www.drupal.org/project/leaflet/issues/2845418 https://www.drupal.org/project/leaflet/issues/3103941 https://www.drupal.org/project/leaflet/issues/3155885 https://www.drupal.org/project/leaflet/issues/1916924 and it's a general problem https://stackoverflow.com/questions/36246815/data-toggle-tab-does-not-download-leaflet-map https://stackoverflow.com/questions/56364129/vue2-leaflet-map-not-showing-properly-in-boostrapvue-modal/56364130
Basically comes down to the render happening too soon, before the position of the map being calculated. The solution is always refreshing the map after its position is finalised - somehow - and this is either theme/page specific, or requires a timeout to wait x ms (which seems real guesswork brittle)
We had this issue before and it was basically fixed by moving to having the geobrowser modal in place of the inline form.
It would be interesting to know the motivation to reverting to inline forms? It does restrict the ability to re-use existing locations; [I have a vague recollection that the inline entity form it needs to use is deprecated? Although I guess that depends on exactly how it's configured. EDIT: this was related to accessing the entity browser via inline entity form in a D10 site].
Conditions:-
So I've got as far as generalizing it pretty radically: https://www.drupal.org/project/geofield_map/issues/3087072#comment-14926247
Basically that JS wherever we end up putting it looks out for the map becoming visible in the viewport and then kicks the resize.
I think we can close this issue, since it's being worked on in a Drupal.org issue instead. @ekes are you okay with us closing this?
This is what we currently have:
This is what we want to have: