Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when map container's width or height are zero #11988

Merged
merged 1 commit into from Feb 6, 2021

Conversation

ahocevar
Copy link
Member

@ahocevar ahocevar commented Feb 6, 2021

Fixes #11984.

I think it makes sense to let the user know why no map is visible in the non obvious case where the container's width or height is 0.

Copy link
Contributor

@MoonE MoonE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ahocevar, not seeing a map because the container had zero height is probably a common problem.

@ahocevar ahocevar merged commit 861fa37 into openlayers:main Feb 6, 2021
@ahocevar ahocevar deleted the warn-zero-size branch February 6, 2021 14:09
@AndreaSGI
Copy link

Thanks, @ahocevar, not seeing a map because the container had zero height is probably a common problem.

How to handle a case when the Map container is hidden (in my case it is not visible because it is in another tab), and the initialization gives this error?

@MoonE
Copy link
Contributor

MoonE commented Aug 25, 2021

This should befixed in the next version by #12632, until then you can simply ignore it.

@AndreaSGI
Copy link

@MoonE I can ignore the warning, but I cannot ignore the empty div without the map rendered 😄

@MoonE
Copy link
Contributor

MoonE commented Aug 25, 2021

The warning message is working as expected when the map is not displayed. Once the map is displayed it should render to the configured target.
How are you expectation it to work / what is not working for you?
You may need to call updateSize once when your map tab becomes visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map no longer renders unless map div height specified explicitly
3 participants