Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new app badge How-to page to PWA docs #25143

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

captainbrosset
Copy link
Contributor

Description

This PR is just one step within the larger PWA docs refresh project: mdn/mdn#280

This PR adds one new How-to page to the PWA docs about using app badges.

Motivation

In the PWA docs refresh project, we agreed to create a new How-to section that will contain 10 to 20 new pages about many of the features that PWAs can use. Displaying app badges is an important one. It's supported on desktop and mobile on a few major browsers, and can be a very effective way to re-engage users with an app. It's also a great web vs. native gap that's been filled and should be documented in our PWA docs.

Related issues and pull requests

CC @wbamberg @estelle

@captainbrosset captainbrosset requested a review from a team as a code owner March 7, 2023 15:14
@captainbrosset captainbrosset requested review from hamishwillee and removed request for a team March 7, 2023 15:14
@github-actions github-actions bot added the Content:Other Any docs not covered by another "Content:" label label Mar 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2023

Preview URLs

External URLs (4)

URL: /en-US/docs/Web/Progressive_web_apps/How_to/Display_badge_on_app_icon
Title: Display a badge on the app icon

(comment last updated: 2023-03-08 10:54:02)

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good. I asked some questions as comments inline about "do we want to mention this or do that?" A few minor text suggestions too.


> **Note:** that this article focuses on the {{domxref("Navigator.setAppBadge()")}} and {{domxref("Navigator.clearAppBadge()")}} methods from the Badging API and ignores the `Navigator.setClientBadge` and `Navigator.clearClientBadge`. Although these methods are defined in the [Badging API specification](https://w3c.github.io/badging/) too, they are not implemented in any browser and are meant to display badges on documents, not on application icons.

### Desktop support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a BCD type table at the bottom or is there a BCD for desktop, browser, and PWA support? Either way, should we move the BCD-esque information to where BCD is normally found? I am sure we will hit this a lot as we write these pages, so thinking we should formalize.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is BCD for setAppBadge() and clearAppBadge():

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/setAppBadge#browser_compatibility
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clearAppBadge#browser_compatibility

This does include the support details that are described in this section of the new page.

I agree that we need a consistent way to represent support in these pages. In #24709 I already complained about using the browser-compat key, on the basis that this isn't a reference doc, but I wonder whether this isn't pointlessly pedantic. We could have a "Compatibility" or "Browser compatibility" H2, but instead of tables, have links to compat for any web platform features discussed, like:

I think there might be some aspects of compat that are hard to capture in BCD, like which browsers support installation at all or which manifest members are mandatory for installation.

I'm going to ask for more opinions.

Copy link
Contributor Author

@captainbrosset captainbrosset Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we need a consistent way to go about this, so that all pages of the same type are the same.
Also, having to write prose for which browsers support a given How-to is going to be hard to maintain.

I had originally added BCD tables in another PR for a PWA How-to page, but Will and I discussed and decided to remove them.

I don't think having BCD tables, as they exist today, is the right option for How-to pages. Say I want to write a How-to about downloading movie files for offline viewing in a PWA. The page will reference multiple technologies such as Streams, IndexedDB, Service Workers, and others. Adding BCD tables for all of them would be messy. This will result in a big wall of, potentially unnecessary, information.

We'd almost want to have a tool, based on BCD, that you can configure to spit out a custom BCD table that only contains what you need for a given page.

// Display the number of unread messages.
navigator.setAppBadge(numberOfUnreadMessages);
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a note about updating as the number of unread messages goes down, not just at zero? That's not really 'how to', more adding hints to good UI practices.

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@estelle estelle merged commit 58c7d92 into mdn:main Mar 8, 2023
@captainbrosset captainbrosset deleted the pwa-app-badge branch March 9, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Other Any docs not covered by another "Content:" label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants