0

When I add matchMedia listener:

matchMedia('print').onchange = (m) => { console.log('print matches', m.matches)}

And I open print dialog, I always see two logs:

print matches true
print matches false

After firing callback with value true, there is immediately another callback with value false even when printing dialog is still open. I would expect that this woud happen only after closing dialog.

Can someone explain to me why it happens?

Tomasz
  • 171
  • 9
  • 1
    This is not reproducible on Safari, though it is on Chrome. My best guess is that Chrome sets it back to false after rendering the print preview since the content inside of the print preview should never change, and Safari doesn't. – Samathingamajig Dec 28 '22 at 09:00

0 Answers0