It turns out that
window.matchMedia doesn’t actually match the resolution media query in Chrome — and maybe in other browsers, too. Also, it frequently does not match
Above you see part of my regular media query test suite. Keep an eye on the last value, that shows which media query is actually enabled right now.
When you zoom or resize the page you see the result of
window.matchMedia("screen and (resolution: DPRdppx )").matches, where DPR is the current value of
The value should always match the media query, but doesn’t.