Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

document.hasFocus() behavior inconsistencies

Avatar

Level 2

Way back during the 2015 beta, I was using document.hasFocus to determine which of the loaded articles was actually being looked at.  I used this to trigger an animation when an article came into view.

This no longer works, and it appears to be functioning differently between Android and iOS.

On iOS, document.hasFocus() is false until the article has SWIPED into view.  If you open a single article, document.hasFocus() returns false until you swipe to another article and then back.  However, after this, it always returns true.

On Android, it always returns false.

Because at any given time, since there are ~3 articles loaded, it wreaks havoc with a bunch of things I want to do, and it's kind of important to be able to tell which one someone is actually looking at.

document.hasFocus() does work properly in Safari on iOS and Chrome on Android, so I know it's not a platform issue.

Any comment on what it'd take to fix this, and/or a suggestion for a workaround?

Jer

0 Replies