When I was in canvas focus, the style of document changed

hello,every one
I use ifreame to embed babylon. When I was in canvas focus, the style of document changed…
Why? this is question video

Does this happen only if you focus the canvas with the developer tools, or if you focus by clicking or tabbing too? Also, does this happen only with a babylon iframe or any iframe? Are you iframing the Babylon viewer, playground or just a regular Babylon page?

The mouse click also triggers this problem. I have found the cause of the problem and the way to reproduce it

When canvas focus, the scroll bar on the document will automatically move to the bottom This may be a browser problem (or not babylon)

sample.zip (20.4 KB)

Thanks for the repro! I investigated it a bit and while I’m not 100% sure, it seems to be some CSS weirdness going on :thinking: It looks like that because the iframe has height: 100%, it is trying to occupy the full page, I’m just not sure why this only happens when it is focused on. However, by messing around I found that if you set display:flex; flex-direction: column; on the body style, it stops trying to do that. My solution for the weirdness that is CSS is usually flexbox :rofl:

1 Like