Allow setting map height to percentage value (D8)

Created on 22 August 2019, almost 5 years ago
Updated 29 June 2024, 4 days ago

I've been trying to get Leaflet and Views to produce a map that fills the screen when the page loads (not to be confused with the option with a button on the map that makes it fullscreen after clicking it). The settings in Views are only pixel-based, and doesn't tolerate percentage.

I have set up page within Views, which prints the map with markers and everything, but the map height is limited to the pixels stated in Views.

In Drupal 7, in an earlier project, a discussion was held and a patch emerged that solved it then ( https://www.drupal.org/project/leaflet/issues/2086539 β†’ ).

Would it be possible to achieve the same functionality within the Drupal 8 version, or is there another way of producing a fullscreen map when the Views page loads?

// Adam

✨ Feature request
Status

Fixed

Version

1.18

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden AdamEvertsson

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the β€œVDC” tag instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States W01F

    Just reporting on this... I recently updated to Drupal 10.3 and Leaflet 10.2.18 and my view maps were not showing. After some tinkering, I discovered the only way I could get them to show again was to:
    1. Unset the height value in the view (leaving it blank)
    2. Add the height CSS style to ".view-content>.leaflet-container" instead of just ".view-content"

    E.g., in my case I changed this:

    .view-map>.view-content {
    	position: relative;
      height: calc(100vh - 200px);
    }

    To this:

    .view-map>.view-content,
    .view-map>.view-content>.leaflet-container {
    	position: relative;
      height: calc(100vh - 200px);
    }
Production build 0.69.0 2024