visibilitychange not firing on app switch on macOS

visibilitychange event is not fired when switching between apps when the window is not maximized.

I have pasted this code block in the console. While this is working on tab change, it is not triggering on app switch ( not maximised )

window.addEventListener('visibilitychange', () => console.log('triggered'), {capture:true});