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

RESOLVED FIXED in Firefox 60

Status

()

RESOLVED FIXED
2 years ago
11 months ago

People

(Reporter: titannanomail, Assigned: droeh)

Tracking

unspecified
Firefox 60
Points:
---

Firefox Tracking Flags

(firefox60 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
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)
(Reporter)

Updated

a year ago
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)
(Reporter)

Comment 4

a year ago
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.
(Assignee)

Comment 5

a year ago
Created attachment 8950312 [details] [diff] [review]
Update GeckoSession.setActive() to focus/blur

This updates GeckoSession.setActive so that we are focusing/blurring in addition to setting the docshell active/inactive.
Assignee: nobody → droeh
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(droeh)
Attachment #8950312 - Flags: review?(snorp)
Attachment #8950312 - Flags: review?(snorp) → review+

Comment 6

a year ago
Pushed by droeh@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/04ed54caac20
Update GeckoSession.setActive to focus/blur as appropriate. r=snorp

Comment 7

11 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/04ed54caac20
Status: NEW → RESOLVED
Last Resolved: 11 months ago
status-firefox60: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 60
You need to log in before you can comment on or make changes to this bug.