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 optional icon for NotificationAction #59

Closed
mvano opened this issue Jan 20, 2016 · 8 comments

Comments

6 participants
@mvano
Copy link
Collaborator

commented Jan 20, 2016

On some platforms the button rendered for a NotificationAction can display an icon. This example shows it on an Android phone and watch.

I propose adding a simple icon attribute (like the one on NotificationOptions):

USVString icon;
@annevk

This comment has been minimized.

Copy link
Member

commented Jan 20, 2016

This seems reasonable. I wonder if any other vendors have implemented this feature.

@johnmellor

This comment has been minimized.

Copy link
Collaborator

commented Jan 20, 2016

There are two subtleties here:

  1. Authors may want to provide multiple resolutions/densities. But I think it's good to go ahead with a single URL string for now, then later on we can match whatever #5 and #28 decide to do for NotificationOptions.icon (presumably we'll either change both to be a union type, or extend the string parsing like srcset does).
  2. The required foreground and background color of the icon are platform-specific (just on Android, KitKat and below show white on black icons, Lollipop and above show dark gray on light gray icons, and Android Wear shows white on blue icons). It's unreasonable to expect authors to provide different icons for every platform (or two icons at once for Lollipop+ phones connected to Android Wear), so instead I'd suggest specifying that the author SHOULD provide an image whose alpha channel can be used on its own as an alpha mask, such that UAs MAY ignore the color channels and generate the appropriate flat color icon(s) from the alpha mask.
    For example some UAs would render the following icon:
    colorful_settings_cog_checkerboard
    as:
    phone_notification
@mvano

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 20, 2016

On 1 I agree that multiple image definitions can be done as a next step.

On 2 I am less keen, though it is a good point. While providing an easily masked icon is good advice for the current crop of popular platforms, I'd rather not include such a recommendation in the normative text. Perhaps it's more appropriate in a non-normative note.

@mvano

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 28, 2016

I wonder if any other vendors have implemented this feature.

It looks like for Windows 10 notification actions you can specify an imageUri in both xml and C#. In the screenshots, they seem to be white on transparent, but I couldn't find official guidance on size, style, or formats.

@mvano

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 28, 2016

On iOS 8 actions for notifications were introduced, but I can't find great information about action icons there. There is this: in this article there's a section about notifications, and this screenshot has a pause icon in it. It seems to be white on transparent, like for Android and Windows.

@beverloo

This comment has been minimized.

Copy link
Member

commented Jan 28, 2016

@marco-c, would you have any input from Mozilla's POV?

@beaufortfrancois

This comment has been minimized.

Copy link

commented Feb 2, 2016

For info, Chrome Apps/Extensions notifications have an iconUrl for notification action buttons: https://developer.chrome.com/apps/notifications#type-NotificationOptions

@annevk annevk closed this in 362780b Feb 2, 2016

@marco-c

This comment has been minimized.

Copy link

commented Feb 5, 2016

Not directly needed for the kind of things I'm currently building, but I can definitely see many use cases for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.