Map preview not shown if height is relative

Created on 19 April 2022, almost 3 years ago
Updated 15 January 2025, 8 days ago

Problem/Motivation

When its height is relative (%), a map does not appear on the preview page.
This is a consequence of an openlayers package change: version 5.0.0 does not suffer from it while 6.14.1 does.

Steps to reproduce

  • Use openlayers 6.14.1.
  • Create a map, set its height to 100%.
  • Display preview page.

The browser console says "No map visible because the map container's width or height are 0.".

Proposed resolution

I have tried to fix it with a CSS-only solution, without success for all situations, even with flex containers.
If I set CSS rules to handle relative heights successfully, absolute heights do not display properly anymore.
min-height does not work: the ideal fix would be the openlayers package supports it.
IMO, a non-absolute height should be changed to some default (400px?) in PHP when displaying a map preview, maybe with a warning message.

🐛 Bug report
Status

Fixed

Version

3.0

Component

OL API

Created by

Live updates comments and jobs are added and updated live.
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.

No activities found.

Production build 0.71.5 2024