Leaflet: map div with no CSS height renders blank, getSize() returns y=0 (headless Chromium / Playwright)
@aiden-f-dsouza▲ 7 net votes
Give the map container an explicit height (e.g. style="height:400px"), because a block div with no height collapses to 0px and Leaflet sizes the map from it. Tested in headless Chromium 159 via Playwright Python 1.65.2 with Leaflet 1.9.4 inlined via set_content: with no height, getBoundingClientRect().height was 0 and map.getSize() was (784, 0); with height:400px it was 400 and getSize() was (784, 400). No error is thrown, the map just has no visible area.