document.hidden/document.visibilityState is false/visible even for windows occluded by other windows (either same-process or other applications)
Categories
(Core :: Widget: Cocoa, defect, P3)
Tracking
()
People
(Reporter: Gijs, Unassigned)
References
(Blocks 1 open bug)
Details
Testing on beta:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:103.0) Gecko/20100101 Firefox/103.0
on macOS big sur (11.6)
If I run e.g. setTimeout(() => console.log(document.hidden), 10000)
in the browser console (so document
is a toplevel/browser.xhtml window), switch applications (all my apps have windows maximized), then wait, it logs false
.
The same thing appears to be true for the document inside the selected tab when the parent window is occluded.
If I switch tabs and log the same thing in a background tab, it correctly switches to true
.
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 1•2 years ago
|
||
It appears that safari also doesn't do this on my machine, so now Emilio and I are wondering if it's just my machine / version of macOS / whatever...
Comment 2•2 years ago
|
||
It works on my macOS machine fwiw. document.visibilityState
in chrome docs doesn't change, but window.isFullyOccluded
is true and document.visibilityState
changes properly as well in content. So it seems something in Gijs' machine might be borked.
Updated•2 years ago
|
Comment 3•2 years ago
|
||
I can reproduce this on Linux, is it worth filing a bug or is window occlusion not supported on Linux?
Comment 4•2 years ago
|
||
Window occlusion is not implemented on Linux afaict.
Comment 5•2 years ago
|
||
(In reply to :Gijs (he/him) from comment #0)
If I run e.g.
setTimeout(() => console.log(document.hidden), 10000)
in the browser console (sodocument
is a toplevel/browser.xhtml window), switch applications (all my apps have windows maximized), then wait, it logsfalse
.The same thing appears to be true for the document inside the selected tab when the parent window is occluded.
If I switch tabs and log the same thing in a background tab, it correctly switches to
true
.
This reminds me a conversation I had with Markus a few weeks ago, I just found it in the Element archives:
florian
I'm testingwindow.isFullyOccluded
in the Browser Toolbox on my Macbook, and it doesn't seem to give me reliable results. Are there known issues, or is it worth trying to find steps to reproduce?
Seems to return false when the window touches either the left or right side of the screen, even if I have a window taking the entire screen above it. That's unfortuate because it means a maximized window is never reported as fully occluded.
ThewindowDidChangeOcclusionState
notification apparently comes directly from the OS, so it might be difficult to do anything about itmstange
yeah exactly!
I've never investigated the cases where it works and where it doesn't
we could add our own heuristics on top of the OS notification, if we have some scenarios where it really makes a difference but any problems with the OS notification would also affect Safariflorian
maximized windows when we have another maximized window on top of it would probably make a difference; if the other maximized window is not ours it's probably harder... and multi-screen situations are also harder, of course.mstange
true
Updated•1 year ago
|
Description
•