Closed Bug 1391076 Opened 5 years ago Closed 4 years ago

standalone PWAs don't fire focus/blur or visibilitychanged events


(Firefox for Android Graveyard :: Web Apps (PWAs), defect)

Not set


(firefox60 fixed)

Firefox 60
Tracking Status
firefox60 --- fixed


(Reporter: jovan.gerodetti, Assigned: droeh)



(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20170810180547

Steps to reproduce:

1. add a site to the homescreen in standalone mode
2. launch the PWA
2. switch to an other app or the homescreen

Actual results:

No window focus/blur or visibilitychanged events are fired when the visibility status of the activity changes. Also document.hidden is always false.

Expected results:

document.hidden should be set to true and the blur event as well as the visibilitychanged event should fire. The focus and visibilitychanged event should also fire when the activity moves back to the foreground.
Hi Ben
please help advise
Flags: needinfo?(bfrancis)
Hi, sorry all I know is that on B2G we used mozbrowservisibilitychange events on the Browser API and some of that code was recently removed in bug 1368712. I would have thought this would be different for Android though.
Flags: needinfo?(bfrancis)
Flags: needinfo?(snorp)
We call GeckoSession.setActive() in onPause() and onResume(), which I would expect to take care of this. Dylan, can you take a look?
Flags: needinfo?(snorp) → needinfo?(droeh)
I tested this again, and it seems that it has improved already:

- document.hidden is correctly set when the PWA goes into the background
- visibilitychange is fired on the document and window when the PWA goes into the background or comes to the front

What still doesn't work:

- no focus or blur event is ever dispatched, when moving the PWA into the background or the foreground

Note: the only time I got a blur event was after I killed the PWA activity.
This updates GeckoSession.setActive so that we are focusing/blurring in addition to setting the docshell active/inactive.
Assignee: nobody → droeh
Ever confirmed: true
Flags: needinfo?(droeh)
Attachment #8950312 - Flags: review?(snorp)
Attachment #8950312 - Flags: review?(snorp) → review+
Pushed by
Update GeckoSession.setActive to focus/blur as appropriate. r=snorp
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 60
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.