In the center of the page, there is a list of different mechanisms which sites can use for detecting focus. They turn red when that mechanism has detected a loss of focus and green when the mechanism detects that you are focused on the page.
For example, when the mouse mechanism turns red, the site has detected your mouse cursor leaving the page.
If any are red, a site could be able to detect that whatever you are doing is outside the page. If multiple mechanisms are red, then it's very likely that a site could detect a loss of focus.
Sites may also use other mechanisms which are not listed here. Because of this, even if all the mechanisms in the list are green, a site could still detect a loss of focus.