2

I have an HTMLElement that is going through a fullscreenchange event. I've added to that event a listener which makes some calculations based the element's clientwidth/clientheight when fullscreened. The problem is that the element's clientheigh value isn't always consistent. Most of the time it has the expected value. In fact, when Devtools is closed, it always behaves correctly. But when Devtools is open (undocked in another monitor, so it doesn't affect the browser's dimensions), clientheight occasionally gets a smaller value.

I think that it happens since the browser has some extra tasks to perform when Devtools is open, and that occasionally these tasks "give enough time" for my listener to run before the element's dimensions managed to adjust to the fullscreen. That's my theory, but I'm not sure if it makes sense - after all, the fullscreenchange event is fired only after the element has finished entering fullscreen, no?

I would appreciate both an explanation as to why that happens, and the correct way to get around this. Thanks

tfreifeld
  • 183
  • 11

0 Answers0