w3c / badging

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

Feature request: Allow additional symbols as the badge value #65

Open mgiuca opened 4 years ago

mgiuca commented 4 years ago

We had an anonymous feature request from the Chrome origin trial feedback:

It would be great to allow a limited set of other characters in the badge - like a + when there is an unknown (not everything yet loaded) or large count to display (e.g. "999+")

Filing an issue to track it, though note that we aren't planning to address this in the first version.

Note that in the original proposal, we allowed any single Unicode character (or, more formally, any grapheme cluster) to be set as the badge value. This feature was dropped because it presented a compatibility risk: some platforms would be able to support certain characters, and others would not. For example, Windows only supports a small set of hand-picked symbols, which do not even necessarily correspond to Unicode characters. There was a risk that browsers implement a hand-picked subset of Unicode characters, and then developers choose to set characters based on that, creating sites that work well on some platforms, and set empty badges on other platforms.

Were we to bring this back, we'd likely hand-pick a small set of symbols that we're sure can be represented on all platforms. Unfortunately, we'd likely be restricted to the lowest common denominator, which is Windows UWP's very restrictive set. It would not be ideal to have a web standard "controlled" by the Windows API. So for the time being, it is probably best to leave this out, until we see a stronger need for it.

g-ortuno commented 4 years ago

IIUC we currently don't badge app tiles on Windows so we don't use that API. IIUC we just draw our own badge on top of the taskbar icon. So we should be able to support whatever characters we want. Or are you concerned that if we ever expand support to app tiles then we won't be able to add support for those characters there?

mgiuca commented 4 years ago

Yes, Chrome's current implementation on Windows would be able to support any symbols we want.

It's more that if we, or any other browser, wants to implement the API using the UWP API instead of the Windows 7 image-based badge API, they would be restricted by the above. And even though there are currently no such implementations, we don't want to restrict the API such that it is not implementable on UWP.

It is possible that future versions of Windows remove the Windows 7 version of the API (and possibly some restricted Windows devices already have).