question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invalidateSize does not work in Firefox when print view triggered

See original GitHub issue

When print view event triggered, then leaflet map.invalidateSize() works in Chrome, but not in Firefox. Firefox version: 53.0 (32-bit) Chrome version: 58.0.3029.81 Leaflet version: 1.0.3

How to reproduce

On page: http://leafletjs.com/index.html To console: JS code:

  • Chrome:
window.matchMedia('print').addListener(
   function(printView){
      if (printView.matches){
         map.invalidateSize();
      }
   }
)
  • Firefox:
window.addEventListener('beforeprint', 
   function() {
      map.invalidateSize();
   }
);

What behaviour I’m expecting and which behaviour I’m seeing

Expecting: You should see same center on map in print view after map.invalidateSize() triggered, than you see in screen view. In Firefox: map.invalidateSize(); is triggered, but map does not rendered to the new size.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
IvanSanchezcommented, Apr 26, 2017

No, you have the same “problem” in chrome if you fiddle with the “custom margins” functionality:

screenshot_20170426_135517 screenshot_20170426_135534

Again, that’s reflowing content without triggering more events.

This is one case of “it’s just not possible to detect this in a web browser”. Detecting reflows in a reliable and performant is impossible. That’s why we still have map.invalidateSize(). 😦

0reactions
nyikesdacommented, Apr 26, 2017

Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix printing problems in Firefox - Mozilla Support
This article describes how to troubleshoot printing problems in Firefox. For general information about printing in Firefox, see How to print web pages...
Read more >
Leaflet broken after print preview in Chrome and Firefox
When the map is visible and you print, no events trigger (leaflet doesn't get broken). When the map is not visible and you...
Read more >
Documentation - a JavaScript library for interactive maps
A value of 0 means the zoom level will not be snapped after fitBounds or a ... movestart, Event, Fired when the view...
Read more >
Use submit in pom With Examples | LambdaTest
Run pom automation tests on LambdaTest cloud grid ; 1(function($){ ; 2/** ; 3 * To make a form auto submit, all you...
Read more >
not adding table component does not correctly - eehelp.com
I noticed that, while this works, attaching class SceneCover application directly gives an error of bps to the exit event. To avoid this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found