w3c / badging

Badging API
https://w3c.github.io/badging/
Other
88 stars 12 forks source link

App badging supposed to work while PWA is not open? #83

Closed getify closed 3 years ago

getify commented 3 years ago

I found this mention in the explainer.

Unlike document badges, badges applied to apps can be shown and updated even when there are no tabs or windows open for the app.

Am I interpreting that correctly, that an app badge set on a PWA while it's not open (like from a SW in the background) should be able to visible? Or that they may or may not be visible?

I ask because from what I can tell, Chrome's PWA badging (at least, on Windows) doesn't seem to show badges for not-open PWAs. I have looked at a few installed PWAs (like Twitter, and my own app) and the badges do not show if added while the PWA is not-open (like via SW). If the PWA is open, and a badge is added, and then the PWA is then closed, the badge goes away.

Is this just an implementation choice/limit that Chrome made? Is it an OS limitation? Or is the specification not clear enough here that app badges should be persistent even for currently-closed PWAs?

From where I sit, if an app badge can only be visible while the app is open, that significantly limits their usefulness, and almost completely removes any benefit to the SW exposed API.

fallaciousreasoning commented 3 years ago

Am I interpreting that correctly, that an app badge set on a PWA while it's not open (like from a SW in the background) should be able to visible? Or that they may or may not be visible?

The standards generally try and not prescribe UI for specific browsers. Ideally, I think badges would be visible when apps aren't open, but it depends on OS conventions (and support) and the choice of specific vendors.

I ask because from what I can tell, Chrome's PWA badging (at least, on Windows) doesn't seem to show badges for not-open PWAs. I have looked at a few installed PWAs (like Twitter, and my own app) and the badges do not show if added while the PWA is not-open (like via SW). If the PWA is open, and a badge is added, and then the PWA is then closed, the badge goes away.

You're right - Chrome does not support badging in the background on macOS or Windows (the only two platforms badging works on). I believe that on macOS, this was an OS limitation, and that on Windows, it was because we didn't have access to the UWP APIs we needed to be able to badge apps in the background (this may have changed since I worked on it).

I think your best bet would be to file a bug on the chromium bug tracker here against the UI>Browser>WebAppInstalls>Badging component sorry 😞

getify commented 3 years ago

https://bugs.chromium.org/p/chromium/issues/detail?id=1196346