Why do firefox-based browsers react incorrectly to window.screenX/Y in my code?

I’m building a home website in which the window will create an illusion of transparency even when windowed and moved around in real time and I’m trying to use screenX and screenY for the cause (I should note that screenLeft and screenTop react the same).

In Google Chrome it reacts well, although the values are a bit weird (moving windowed windows on left edge will return -25)
In Firefox the function always returns 0, unless windowed, in that case it returns constant 25.
In Librewolf, the target browser, I always get constant 0. Letterboxing seems to have no effect.
Why is it that way, why only on Chrome and how can I fix this issue? I found no relevant fixes on this topic.
(If it’s relevant, which I doubt, I’m on linux with wayland)
Thanks beforehand.

The code in which I’m trying to utilize the functions:

const canvas = document.getElementById("background");
const context = canvas.getContext("2d");

var pozadi = new Image();
pozadi.src = "image.png";
var hod_x = window.screenX;
var hod_y = window.screenY;

pozadi.onload = function() {
  context.drawImage(pozadi, hod_x, hod_y, 2240, 1217, 0, 0, 2240, 1217);
}
body {
  margin: 0px
}
<canvas id="background" width="2240px" height="1217px"></canvas>